source: webkit/trunk/JavaScriptCore/kjs/JSImmediate.cpp@ 15310

Last change on this file since 15310 was 13821, checked in by darin, 19 years ago

JavaScriptCore:

Rubber-stamped by John Sullivan.

  • switched from a shell script to a makefile for generated files
  • removed lots of unneeded includes
  • added new Forward.h and HashForward.h headers that allow compiling with fewer unneeded templates
  • DerivedSources.make: Added.
  • generate-derived-sources: Removed.
  • JavaScriptCore.xcodeproj/project.pbxproj: Added new files, changed to use DerivedSources.make.
  • kxmlcore/Forward.h: Added.
  • kxmlcore/HashForward.h: Added.
  • kxmlcore/HashCountedSet.h: Include HashForward for default args.
  • kxmlcore/HashMap.h: Ditto.
  • kxmlcore/HashSet.h: Ditto.
  • kjs/object.h:
  • kjs/object.cpp: Moved KJS_MAX_STACK into the .cpp file.
  • bindings/NP_jsobject.cpp:
  • bindings/c/c_instance.h:
  • bindings/jni/jni_class.h:
  • bindings/jni/jni_runtime.h:
  • bindings/jni/jni_utility.h:
  • bindings/objc/WebScriptObject.mm:
  • bindings/objc/WebScriptObjectPrivate.h:
  • bindings/objc/objc_class.h:
  • bindings/objc/objc_class.mm:
  • bindings/objc/objc_instance.h:
  • bindings/objc/objc_instance.mm:
  • bindings/objc/objc_runtime.mm:
  • bindings/objc/objc_utility.mm:
  • bindings/runtime.h:
  • bindings/runtime_array.cpp:
  • bindings/runtime_array.h:
  • bindings/runtime_method.cpp:
  • bindings/runtime_method.h:
  • bindings/runtime_object.cpp:
  • bindings/runtime_root.h:
  • kjs/JSImmediate.cpp:
  • kjs/Parser.h:
  • kjs/array_object.cpp:
  • kjs/array_object.h:
  • kjs/bool_object.cpp:
  • kjs/bool_object.h:
  • kjs/collector.h:
  • kjs/context.h:
  • kjs/debugger.cpp:
  • kjs/error_object.h:
  • kjs/function_object.h:
  • kjs/internal.h:
  • kjs/lexer.cpp:
  • kjs/math_object.cpp:
  • kjs/math_object.h:
  • kjs/nodes.cpp:
  • kjs/nodes.h:
  • kjs/number_object.cpp:
  • kjs/number_object.h:
  • kjs/object_object.cpp:
  • kjs/operations.cpp:
  • kjs/protected_reference.h:
  • kjs/reference.h:
  • kjs/reference_list.h:
  • kjs/regexp_object.h:
  • kjs/string_object.cpp:
  • kjs/string_object.h:
  • kjs/testkjs.cpp:
  • kjs/value.cpp:
  • kjs/value.h:
  • kxmlcore/HashTable.h:
  • kxmlcore/ListRefPtr.h:
  • kxmlcore/TCPageMap.h:
  • kxmlcore/Vector.h: Removed unneeded header includes.

JavaScriptGlue:

Rubber-stamped by John Sullivan.

  • added forwarding headers for the new Forward.h and HashForward.h files
  • kxmlcore/Forward.h: Added.
  • kxmlcore/HashForward.h: Added.

WebCore:

Rubber-stamped by John Sullivan (except for pbxproj change).

  • updated to use the new Forward.h and HashForward.h headers
  • moved the showTree debugging functions out of the WebCore namespace so they are easier to call from gdb, and renamed the showTree member functions so they don't get in the way; now you can do "call showTree(x)" in gdb and it just works
  • removed a lot of unneeded includes
  • WebCore.xcodeproj/project.pbxproj: Fixed a lot of paths that were not relative to the enclosing group.
  • ForwardingHeaders/kxmlcore/Forward.h: Added.
  • ForwardingHeaders/kxmlcore/HashForward.h: Added.
  • bindings/js/JSCanvasRenderingContext2DBase.cpp:
  • bindings/js/JSXMLHttpRequest.cpp:
  • bindings/js/JSXMLHttpRequest.h:
  • bindings/js/JSXSLTProcessor.h:
  • bindings/js/kjs_binding.h:
  • bindings/js/kjs_dom.cpp:
  • bindings/js/kjs_dom.h:
  • bindings/js/kjs_events.cpp:
  • bindings/js/kjs_events.h:
  • bindings/js/kjs_html.cpp:
  • bindings/js/kjs_navigator.cpp:
  • bindings/js/kjs_navigator.h:
  • bindings/js/kjs_proxy.cpp:
  • bindings/js/kjs_traversal.h:
  • bindings/js/kjs_window.cpp:
  • bindings/js/kjs_window.h:
  • bindings/objc/DOM.mm:
  • bindings/objc/DOMCSS.mm:
  • bindings/objc/DOMCore.h:
  • bindings/objc/DOMEvents.mm:
  • bindings/objc/DOMHTML.mm:
  • bindings/objc/DOMImplementationFront.h:
  • bindings/objc/DOMInternal.mm:
  • bindings/objc/DOMUtility.mm:
  • bindings/objc/DOMViews.mm:
  • bridge/BrowserExtension.h:
  • bridge/mac/BrowserExtensionMac.mm:
  • bridge/mac/FrameMac.h:
  • bridge/mac/FrameMac.mm:
  • bridge/mac/WebCoreFrameBridge.mm:
  • bridge/mac/WebCoreFrameNamespaces.mm:
  • bridge/mac/WebCoreJavaScript.mm:
  • bridge/win/PageWin.cpp:
  • css/CSSComputedStyleDeclaration.cpp:
  • css/css_base.h:
  • css/css_ruleimpl.h:
  • css/css_valueimpl.cpp:
  • css/cssparser.cpp:
  • css/cssparser.h:
  • css/cssstyleselector.cpp:
  • css/cssstyleselector.h:
  • dom/AbstractView.h:
  • dom/AtomicStringList.h:
  • dom/Attribute.cpp:
  • dom/Attribute.h:
  • dom/Comment.cpp:
  • dom/ContainerNode.cpp:
  • dom/DOMImplementation.cpp:
  • dom/DOMImplementation.h:
  • dom/Document.cpp:
  • dom/Document.h:
  • dom/Element.h:
  • dom/EventTargetNode.cpp: (WebCore::EventTargetNode::dump): (WebCore::forbidEventDispatch): (WebCore::allowEventDispatch): (WebCore::eventDispatchForbidden):
  • dom/EventTargetNode.h: (WebCore::EventTargetNode::postDispatchEventHandler):
  • dom/NamedAttrMap.h:
  • dom/Node.cpp: (WebCore::Node::showNode): (WebCore::Node::showTree): (WebCore::Node::showTreeAndMark): (showTree):
  • dom/Node.h:
  • dom/NodeList.cpp:
  • dom/NodeList.h:
  • dom/Position.cpp: (showTree):
  • dom/Position.h:
  • dom/Range.cpp:
  • dom/Range.h:
  • dom/StyledElement.cpp:
  • dom/StyledElement.h:
  • dom/dom2_eventsimpl.cpp:
  • dom/dom2_eventsimpl.h:
  • dom/dom2_traversalimpl.h:
  • dom/dom_xmlimpl.cpp:
  • dom/xml_tokenizer.cpp:
  • dom/xml_tokenizer.h:
  • editing/AppendNodeCommand.cpp:
  • editing/ApplyStyleCommand.cpp:
  • editing/ApplyStyleCommand.h:
  • editing/BreakBlockquoteCommand.cpp:
  • editing/CompositeEditCommand.cpp:
  • editing/CreateLinkCommand.cpp:
  • editing/DeleteFromTextNodeCommand.cpp:
  • editing/DeleteFromTextNodeCommand.h:
  • editing/DeleteSelectionCommand.cpp:
  • editing/EditCommand.cpp:
  • editing/EditCommand.h:
  • editing/HTMLInterchange.cpp:
  • editing/InsertIntoTextNodeCommand.cpp:
  • editing/InsertIntoTextNodeCommand.h:
  • editing/InsertLineBreakCommand.cpp:
  • editing/InsertNodeBeforeCommand.cpp:
  • editing/InsertParagraphSeparatorCommand.cpp:
  • editing/InsertTextCommand.cpp:
  • editing/JSEditor.cpp:
  • editing/JoinTextNodesCommand.cpp:
  • editing/MergeIdenticalElementsCommand.cpp:
  • editing/ModifySelectionListLevelCommand.cpp:
  • editing/MoveSelectionCommand.cpp:
  • editing/RebalanceWhitespaceCommand.h:
  • editing/RemoveCSSPropertyCommand.h:
  • editing/ReplaceSelectionCommand.cpp:
  • editing/ReplaceSelectionCommand.h:
  • editing/Selection.cpp: (WebCore::Selection::formatForDebugger): (WebCore::Selection::showTree): (showTree):
  • editing/Selection.h:
  • editing/SelectionController.cpp: (WebCore::SelectionController::formatForDebugger): (WebCore::SelectionController::showTree): (showTree):
  • editing/SelectionController.h:
  • editing/TextIterator.cpp:
  • editing/TextIterator.h:
  • editing/TypingCommand.cpp:
  • editing/TypingCommand.h:
  • editing/UnlinkCommand.cpp:
  • editing/VisiblePosition.cpp: (WebCore::isEqualIgnoringAffinity): (WebCore::VisiblePosition::formatForDebugger): (WebCore::VisiblePosition::showTree): (showTree):
  • editing/VisiblePosition.h: (WebCore::VisiblePosition::VisiblePosition): (WebCore::operator==):
  • editing/WrapContentsInDummySpanCommand.cpp:
  • editing/htmlediting.h:
  • editing/markup.cpp:
  • editing/markup.h: (WebCore::):
  • editing/visible_units.cpp:
  • html/CanvasGradient.cpp:
  • html/CanvasRenderingContext2D.h:
  • html/CanvasStyle.cpp:
  • html/CanvasStyle.h:
  • html/FormDataList.cpp:
  • html/FormDataList.h:
  • html/HTMLCollection.cpp:
  • html/HTMLCollection.h:
  • html/HTMLDocument.cpp:
  • html/HTMLDocument.h:
  • html/HTMLElement.cpp:
  • html/HTMLElementFactory.cpp:
  • html/HTMLElementFactory.h:
  • html/HTMLFormCollection.cpp:
  • html/HTMLFormElement.cpp:
  • html/HTMLFormElement.h:
  • html/HTMLInputElement.cpp:
  • html/HTMLParser.cpp:
  • html/HTMLSelectElement.cpp:
  • html/HTMLSelectElement.h:
  • html/HTMLTokenizer.cpp:
  • html/HTMLTokenizer.h:
  • html/html_baseimpl.cpp:
  • html/html_headimpl.h:
  • kcanvas/KCanvasCreator.cpp:
  • kcanvas/KCanvasFilters.h:
  • kcanvas/KCanvasPath.h:
  • kcanvas/KCanvasResources.h:
  • kcanvas/KCanvasTreeDebug.cpp:
  • kcanvas/RenderPath.cpp:
  • kcanvas/RenderPath.h:
  • kcanvas/device/KRenderingDevice.h:
  • kcanvas/device/KRenderingPaintServerGradient.h:
  • kcanvas/device/KRenderingPaintServerPattern.h:
  • kcanvas/device/KRenderingPaintServerSolid.h:
  • kcanvas/device/quartz/KCanvasFilterQuartz.mm:
  • kcanvas/device/quartz/KCanvasMaskerQuartz.h:
  • kcanvas/device/quartz/KCanvasResourcesQuartz.h:
  • kcanvas/device/quartz/KCanvasResourcesQuartz.mm:
  • kcanvas/device/quartz/KRenderingPaintServerQuartz.h:
  • khtml/misc/decoder.cpp:
  • khtml/misc/decoder.h:
  • khtml/xsl/XSLStyleSheet.cpp:
  • khtml/xsl/XSLTProcessor.cpp:
  • khtml/xsl/XSLTProcessor.h:
  • ksvg2/css/SVGRenderStyle.h:
  • ksvg2/ecma/GlobalObject.cpp:
  • ksvg2/misc/KCanvasRenderingStyle.h:
  • ksvg2/misc/SVGDocumentExtensions.h:
  • ksvg2/svg/SVGAngle.h:
  • ksvg2/svg/SVGAnimateColorElement.h:
  • ksvg2/svg/SVGAnimatedColor.h:
  • ksvg2/svg/SVGAnimatedLengthList.h:
  • ksvg2/svg/SVGAnimatedNumberList.h:
  • ksvg2/svg/SVGAnimatedString.h:
  • ksvg2/svg/SVGAnimatedTransformList.h:
  • ksvg2/svg/SVGAnimationElement.h:
  • ksvg2/svg/SVGColor.h:
  • ksvg2/svg/SVGCursorElement.h:
  • ksvg2/svg/SVGHelper.h:
  • ksvg2/svg/SVGLength.h:
  • ksvg2/svg/SVGList.h:
  • ksvg2/svg/SVGPaint.h:
  • ksvg2/svg/SVGPathSeg.h:
  • ksvg2/svg/SVGPatternElement.h:
  • ksvg2/svg/SVGSVGElement.cpp:
  • ksvg2/svg/SVGSVGElement.h:
  • ksvg2/svg/SVGStringList.h:
  • ksvg2/svg/SVGTransform.h:
  • kwq/AccessibilityObjectCache.mm:
  • kwq/ClipboardMac.mm:
  • kwq/JavaAppletWidget.mm:
  • kwq/KWQComboBox.mm:
  • kwq/KWQEditCommand.mm:
  • kwq/KWQFileButton.mm:
  • kwq/KWQKHTMLSettings.h:
  • kwq/KWQKSSLKeyGen.mm:
  • kwq/KWQLoader.mm:
  • kwq/KWQPageState.mm:
  • kwq/KWQTextEdit.mm:
  • kwq/RegularExpression.h:
  • kwq/RenderTreeAsText.cpp:
  • kwq/RenderTreeAsText.h:
  • kwq/WebCoreAXObject.mm:
  • loader/Cache.cpp:
  • loader/Cache.h:
  • loader/CachedCSSStyleSheet.cpp:
  • loader/CachedObject.h:
  • loader/CachedScript.cpp:
  • loader/CachedXBLDocument.cpp:
  • loader/CachedXBLDocument.h:
  • loader/CachedXSLStyleSheet.cpp:
  • loader/CachedXSLStyleSheet.h:
  • loader/DocLoader.cpp:
  • page/Frame.cpp:
  • page/Frame.h:
  • page/FramePrivate.h:
  • page/FrameTree.cpp:
  • page/FrameTree.h:
  • page/FrameView.cpp:
  • page/FrameView.h:
  • page/Page.cpp:
  • page/Page.h:
  • page/Plugin.h: (WebCore::Plugin::Plugin): (WebCore::Plugin::view):
  • platform/Color.cpp:
  • platform/FloatRect.h:
  • platform/Font.cpp:
  • platform/Font.h:
  • platform/FontFamily.cpp:
  • platform/GraphicsContext.cpp:
  • platform/Image.cpp:
  • platform/Image.h:
  • platform/IntRect.h:
  • platform/KURL.cpp:
  • platform/KURL.h:
  • platform/SegmentedString.h:
  • platform/Shared.h:
  • platform/StreamingTextDecoder.cpp:
  • platform/StringImpl.cpp:
  • platform/StringImpl.h:
  • platform/TextEncoding.h:
  • platform/Timer.cpp:
  • platform/Timer.h:
  • platform/TransferJob.cpp:
  • platform/TransferJob.h:
  • platform/TransferJobInternal.h:
  • platform/cairo/GraphicsContextCairo.cpp:
  • platform/cairo/ImageCairo.cpp:
  • platform/cairo/ImageSourceCairo.cpp:
  • platform/image-decoders/gif/GIFImageReader.cpp:
  • platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
  • platform/mac/FontFamilyMac.mm:
  • platform/mac/FontMac.mm:
  • platform/mac/ImageMac.mm:
  • platform/mac/TextEncodingMac.cpp:
  • platform/mac/TransferJobMac.mm:
  • platform/win/FontPlatformDataWin.cpp:
  • platform/win/TransferJobWin.cpp:
  • rendering/RenderBlock.cpp:
  • rendering/RenderBlock.h:
  • rendering/RenderBox.cpp:
  • rendering/RenderBox.h:
  • rendering/RenderCanvas.cpp:
  • rendering/RenderCanvas.h:
  • rendering/RenderContainer.cpp:
  • rendering/RenderFlexibleBox.h:
  • rendering/RenderFlow.cpp:
  • rendering/RenderFlow.h:
  • rendering/RenderImage.cpp:
  • rendering/RenderImage.h:
  • rendering/RenderLayer.cpp:
  • rendering/RenderLayer.h:
  • rendering/RenderObject.cpp: (showTree):
  • rendering/RenderObject.h:
  • rendering/RenderTableCell.h:
  • rendering/RenderTableSection.h:
  • rendering/RenderText.cpp:
  • rendering/RenderText.h:
  • rendering/RenderTextField.cpp:
  • rendering/RenderTextFragment.h:
  • rendering/RenderTheme.h:
  • rendering/RenderThemeMac.mm:
  • rendering/RenderThemeWin.cpp:
  • rendering/bidi.cpp:
  • rendering/render_form.h:
  • rendering/render_line.cpp: (showTree):
  • rendering/render_line.h:
  • rendering/render_list.cpp:
  • rendering/render_replaced.cpp:
  • rendering/render_replaced.h:
  • rendering/render_style.cpp:
  • rendering/render_style.h:
  • xml/xmlhttprequest.h:
  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1/*
2 * This file is part of the KDE libraries
3 * Copyright (C) 2003-2006 Apple Computer, Inc
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 *
20 */
21
22#include "config.h"
23#include "JSImmediate.h"
24
25#include "object.h"
26
27namespace KJS {
28
29JSObject *JSImmediate::toObject(const JSValue *v, ExecState *exec)
30{
31 assert(isImmediate(v));
32 if (v == jsNull())
33 return throwError(exec, TypeError, "Null value");
34 else if (v == jsUndefined())
35 return throwError(exec, TypeError, "Undefined value");
36 else if (isBoolean(v)) {
37 List args;
38 args.append(const_cast<JSValue *>(v));
39 return exec->lexicalInterpreter()->builtinBoolean()->construct(exec, args);
40 } else {
41 ASSERT(isNumber(v));
42 List args;
43 args.append(const_cast<JSValue *>(v));
44 return exec->lexicalInterpreter()->builtinNumber()->construct(exec, args);
45 }
46}
47
48UString JSImmediate::toString(const JSValue *v)
49{
50 ASSERT(isImmediate(v));
51
52 if (v == jsNull())
53 return "null";
54 else if (v == jsUndefined())
55 return "undefined";
56 else if (v == jsBoolean(true))
57 return "true";
58 else if (v == jsBoolean(false))
59 return "false";
60 else {
61 assert(isNumber(v));
62 double d = toDouble(v);
63 if (d == 0.0) // +0.0 or -0.0
64 return "0";
65 return UString::from(d);
66 }
67}
68
69JSType JSImmediate::type(const JSValue *v)
70{
71 ASSERT(isImmediate(v));
72
73 uintptr_t tag = getTag(v);
74 if (tag == UndefinedType)
75 return v == jsUndefined() ? UndefinedType : NullType;
76 return static_cast<JSType>(tag);
77}
78
79} // namespace KJS
Note: See TracBrowser for help on using the repository browser.