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

Last change on this file since 15310 was 14256, checked in by mjs, 19 years ago

JavaScriptCore:

Rubber stamped by Anders.


  • renamed kxmlcore to wtf


kxmlcore --> wtf
KXMLCore --> WTF
WKC --> WTF

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bindings/c/c_instance.cpp:
  • bindings/objc/WebScriptObject.mm:
  • kjs/JSImmediate.h:
  • kjs/Parser.cpp:
  • kjs/Parser.h:
  • kjs/array_object.cpp:
  • kjs/collector.cpp: (KJS::Collector::registerThread):
  • kjs/collector.h:
  • kjs/config.h:
  • kjs/function.cpp: (KJS::isStrWhiteSpace):
  • kjs/function.h:
  • kjs/identifier.cpp:
  • kjs/internal.cpp:
  • kjs/internal.h:
  • kjs/lexer.cpp: (Lexer::shift): (Lexer::isWhiteSpace): (Lexer::isIdentStart): (Lexer::isIdentPart):
  • kjs/lookup.cpp:
  • kjs/nodes.cpp:
  • kjs/nodes.h:
  • kjs/number_object.cpp:
  • kjs/object.h:
  • kjs/property_map.cpp:
  • kjs/property_map.h:
  • kjs/string_object.cpp: (StringProtoFunc::callAsFunction):
  • kjs/testkjs.cpp: (testIsInteger):
  • kjs/ustring.cpp:
  • kjs/ustring.h:
  • kxmlcore: Removed.
  • kxmlcore/AlwaysInline.h: Removed.
  • kxmlcore/Assertions.cpp: Removed.
  • kxmlcore/Assertions.h: Removed.
  • kxmlcore/FastMalloc.cpp: Removed.
  • kxmlcore/FastMalloc.h: Removed.
  • kxmlcore/FastMallocInternal.h: Removed.
  • kxmlcore/Forward.h: Removed.
  • kxmlcore/HashCountedSet.h: Removed.
  • kxmlcore/HashFunctions.h: Removed.
  • kxmlcore/HashMap.h: Removed.
  • kxmlcore/HashSet.h: Removed.
  • kxmlcore/HashTable.cpp: Removed.
  • kxmlcore/HashTable.h: Removed.
  • kxmlcore/HashTraits.h: Removed.
  • kxmlcore/ListRefPtr.h: Removed.
  • kxmlcore/Noncopyable.h: Removed.
  • kxmlcore/OwnArrayPtr.h: Removed.
  • kxmlcore/OwnPtr.h: Removed.
  • kxmlcore/PassRefPtr.h: Removed.
  • kxmlcore/Platform.h: Removed.
  • kxmlcore/RefPtr.h: Removed.
  • kxmlcore/TCPageMap.h: Removed.
  • kxmlcore/TCSpinLock.h: Removed.
  • kxmlcore/TCSystemAlloc.cpp: Removed.
  • kxmlcore/TCSystemAlloc.h: Removed.
  • kxmlcore/UnusedParam.h: Removed.
  • kxmlcore/Vector.h: Removed.
  • kxmlcore/VectorTraits.h: Removed.
  • kxmlcore/unicode: Removed.
  • kxmlcore/unicode/Unicode.h: Removed.
  • kxmlcore/unicode/UnicodeCategory.h: Removed.
  • kxmlcore/unicode/icu: Removed.
  • kxmlcore/unicode/icu/UnicodeIcu.h: Removed.
  • kxmlcore/unicode/posix: Removed.
  • kxmlcore/unicode/qt3: Removed.
  • kxmlcore/unicode/qt4: Removed.
  • kxmlcore/unicode/qt4/UnicodeQt4.h: Removed.
  • pcre/pcre_get.c:
  • wtf: Added.
  • wtf/Assertions.cpp:
  • wtf/Assertions.h:
  • wtf/FastMalloc.cpp: (WTF::TCMalloc_ThreadCache::Scavenge): (WTF::do_malloc): (WTF::do_free): (WTF::TCMallocGuard::TCMallocGuard): (WTF::malloc): (WTF::free): (WTF::calloc): (WTF::cfree): (WTF::realloc):
  • wtf/FastMalloc.h:
  • wtf/FastMallocInternal.h:
  • wtf/Forward.h:
  • wtf/HashCountedSet.h:
  • wtf/HashFunctions.h:
  • wtf/HashMap.h:
  • wtf/HashSet.h:
  • wtf/HashTable.cpp:
  • wtf/HashTable.h:
  • wtf/HashTraits.h:
  • wtf/ListRefPtr.h:
  • wtf/Noncopyable.h:
  • wtf/OwnArrayPtr.h:
  • wtf/OwnPtr.h:
  • wtf/PassRefPtr.h:
  • wtf/RefPtr.h:
  • wtf/TCSystemAlloc.cpp: (TCMalloc_SystemAlloc):
  • wtf/Vector.h:
  • wtf/VectorTraits.h:
  • wtf/unicode/UnicodeCategory.h:
  • wtf/unicode/icu/UnicodeIcu.h:

JavaScriptGlue:

Rubber stamped by Anders.


  • renamed kxmlcore to wtf


kxmlcore --> wtf
KXMLCore --> WTF
WKC --> WTF

  • config.h:
  • kxmlcore: Removed.
  • kxmlcore/AlwaysInline.h: Removed.
  • kxmlcore/Assertions.h: Removed.
  • kxmlcore/FastMalloc.h: Removed.
  • kxmlcore/Forward.h: Removed.
  • kxmlcore/HashCountedSet.h: Removed.
  • kxmlcore/HashSet.h: Removed.
  • kxmlcore/Noncopyable.h: Removed.
  • kxmlcore/OwnArrayPtr.h: Removed.
  • kxmlcore/OwnPtr.h: Removed.
  • kxmlcore/PassRefPtr.h: Removed.
  • kxmlcore/Platform.h: Removed.
  • kxmlcore/RefPtr.h: Removed.
  • kxmlcore/Vector.h: Removed.
  • wtf: Added.

WebCore:

Rubber stamped by Anders.


  • renamed kxmlcore to wtf


kxmlcore --> wtf
KXMLCore --> WTF
WKC --> WTF

  • ForwardingHeaders/kxmlcore: Removed.
  • ForwardingHeaders/kxmlcore/AlwaysInline.h: Removed.
  • ForwardingHeaders/kxmlcore/Assertions.h: Removed.
  • ForwardingHeaders/kxmlcore/FastMalloc.h: Removed.
  • ForwardingHeaders/kxmlcore/Forward.h: Removed.
  • ForwardingHeaders/kxmlcore/HashCountedSet.h: Removed.
  • ForwardingHeaders/kxmlcore/HashMap.h: Removed.
  • ForwardingHeaders/kxmlcore/HashSet.h: Removed.
  • ForwardingHeaders/kxmlcore/HashTraits.h: Removed.
  • ForwardingHeaders/kxmlcore/Noncopyable.h: Removed.
  • ForwardingHeaders/kxmlcore/OwnArrayPtr.h: Removed.
  • ForwardingHeaders/kxmlcore/OwnPtr.h: Removed.
  • ForwardingHeaders/kxmlcore/PassRefPtr.h: Removed.
  • ForwardingHeaders/kxmlcore/Platform.h: Removed.
  • ForwardingHeaders/kxmlcore/RefPtr.h: Removed.
  • ForwardingHeaders/kxmlcore/Vector.h: Removed.
  • ForwardingHeaders/wtf: Added.
  • bindings/js/JSHTMLElementWrapperFactory.h:
  • bindings/js/kjs_binding.cpp:
  • bindings/js/kjs_window.h:
  • bindings/objc/DOMImplementationFront.h:
  • bridge/JavaAppletWidget.h:
  • bridge/mac/WebCoreFrameNamespaces.mm:
  • bridge/mac/WebCorePageBridge.mm: (initializeLogChannel):
  • bridge/mac/WebCoreStringTruncator.mm:
  • bridge/mac/WebCoreViewFactory.m:
  • config.h:
  • css/css_base.h:
  • css/css_valueimpl.h:
  • css/csshelper.cpp:
  • css/cssparser.h:
  • dom/DOMImplementation.h:
  • dom/Document.h:
  • dom/NamedNodeMap.h:
  • dom/Node.h:
  • dom/NodeList.h:
  • dom/QualifiedName.cpp:
  • dom/Range.h:
  • dom/StyledElement.cpp:
  • dom/dom2_traversalimpl.h:
  • dom/xml_tokenizer.h:
  • editing/RebalanceWhitespaceCommand.cpp:
  • editing/RemoveCSSPropertyCommand.cpp:
  • editing/RemoveNodeAttributeCommand.cpp:
  • editing/RemoveNodeCommand.cpp:
  • editing/RemoveNodePreservingChildrenCommand.cpp:
  • editing/ReplaceSelectionCommand.h:
  • editing/Selection.cpp:
  • editing/SetNodeAttributeCommand.cpp:
  • editing/SplitElementCommand.cpp:
  • editing/SplitTextNodeCommand.cpp:
  • editing/SplitTextNodeContainingElementCommand.cpp:
  • editing/TextIterator.h:
  • editing/htmlediting.h:
  • editing/markup.h:
  • html/CanvasGradient.h:
  • html/CanvasRenderingContext2D.h:
  • html/CanvasStyle.cpp:
  • html/HTMLCollection.h:
  • html/HTMLElementFactory.h:
  • kcanvas/KCanvasFilters.cpp:
  • kcanvas/KCanvasPath.h:
  • kcanvas/RenderPath.cpp:
  • kcanvas/RenderSVGImage.cpp:
  • kcanvas/RenderSVGText.cpp:
  • kcanvas/device/quartz/KCanvasItemQuartz.mm:
  • kcanvas/device/quartz/KRenderingPaintServerGradientQuartz.mm:
  • kcanvas/device/quartz/QuartzSupport.mm:
  • ksvg2/misc/KSVGTimeScheduler.h:
  • ksvg2/misc/SVGDocumentExtensions.h:
  • ksvg2/scripts/make_names.pl:
  • ksvg2/svg/SVGDOMImplementation.cpp:
  • ksvg2/svg/SVGExternalResourcesRequired.h:
  • ksvg2/svg/SVGFilterPrimitiveStandardAttributes.cpp:
  • ksvg2/svg/SVGForeignObjectElement.cpp:
  • ksvg2/svg/SVGImageElement.cpp:
  • ksvg2/svg/SVGMaskElement.cpp:
  • ksvg2/svg/SVGStyledElement.cpp:
  • ksvg2/svg/SVGTests.h:
  • ksvg2/svg/SVGTransform.h:
  • ksvg2/svg/SVGTransformable.cpp:
  • kwq/AccessibilityObjectCache.h:
  • kwq/KWQCString.cpp:
  • kwq/KWQFormData.mm:
  • kwq/KWQListBox.mm:
  • kwq/KWQResourceLoader.mm:
  • kwq/KWQTextEdit.mm:
  • loader/Cache.h:
  • loader/CachedObject.h:
  • loader/CachedObjectClientWalker.h:
  • loader/Decoder.h:
  • loader/DocLoader.h:
  • loader/loader.cpp:
  • loader/loader.h:
  • page/DOMWindow.h:
  • page/Frame.h:
  • page/FramePrivate.h:
  • page/FrameTree.cpp:
  • page/Page.cpp:
  • page/Page.h:
  • page/Plugin.h:
  • platform/Arena.cpp:
  • platform/ArrayImpl.h:
  • platform/AtomicString.cpp:
  • platform/CharsetNames.cpp:
  • platform/Color.cpp:
  • platform/DeprecatedPtrListImpl.cpp:
  • platform/DeprecatedValueListImpl.h:
  • platform/FontFallbackList.h:
  • platform/GraphicsContext.h:
  • platform/GraphicsTypes.cpp:
  • platform/Image.h:
  • platform/KURL.cpp:
  • platform/Logging.cpp:
  • platform/Logging.h:
  • platform/PlatformString.h:
  • platform/PlugInInfoStore.h:
  • platform/StreamingTextDecoder.cpp:
  • platform/StreamingTextDecoder.h:
  • platform/String.cpp:
  • platform/StringHash.h:
  • platform/StringImpl.cpp:
  • platform/StringImpl.h:
  • platform/TextEncoding.cpp:
  • platform/Timer.cpp:
  • platform/Timer.h:
  • platform/TransferJob.h:
  • platform/TransferJobInternal.h:
  • platform/mac/BlockExceptions.mm:
  • platform/mac/ColorMac.mm:
  • platform/mac/FontData.mm:
  • platform/mac/KURLMac.mm:
  • platform/mac/QStringMac.mm:
  • platform/mac/SharedTimerMac.cpp:
  • platform/mac/TextEncodingMac.cpp:
  • platform/mac/WebCoreImageRendererFactory.m:
  • platform/mac/WebCoreKeyGenerator.m:
  • platform/mac/WebCoreTextArea.mm:
  • platform/mac/WebCoreTextField.mm:
  • platform/mac/WebTextRendererFactory.h:
  • platform/mac/WebTextRendererFactory.mm:
  • platform/win/TemporaryLinkStubs.cpp: (JavaAppletWidget::JavaAppletWidget):
  • rendering/InlineTextBox.cpp:
  • rendering/RenderText.cpp:
  • rendering/RenderTreeAsText.cpp:
  • rendering/bidi.cpp:
  • xml/XSLTProcessor.h:
  • xpath/impl/XPathExpressionNode.h:
  • xpath/impl/XPathParser.h:
  • xpath/impl/XPathPath.h:
  • xpath/impl/XPathUtil.h:

WebKit:

Rubber stamped by Anders.


  • renamed kxmlcore to wtf


kxmlcore --> wtf
KXMLCore --> WTF
WKC --> WTF

  • Misc/WebKitLogging.h:
  • Misc/WebKitLogging.m: (initializeLogChannel):
  • Property svn:eol-style set to native
File size: 2.6 KB
Line 
1// -*- c-basic-offset: 2 -*-
2/*
3 * This file is part of the KDE libraries
4 * Copyright (C) 1999-2000 Harri Porten ([email protected])
5 * Copyright (C) 2003 Apple Computer, Inc.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 */
22
23#include "config.h"
24#include <stdio.h>
25#include <string.h>
26
27#include "lookup.h"
28#include <wtf/Assertions.h>
29
30using namespace KJS;
31
32static inline bool keysMatch(const UChar *c, unsigned len, const char *s)
33{
34 const char* end = s + len;
35 for (; s != end; c++, s++)
36 if (c->uc != (unsigned char)*s)
37 return false;
38 return *s == 0;
39}
40
41static inline const HashEntry* findEntry(const struct HashTable *table, unsigned int hash,
42 const UChar *c, unsigned int len )
43{
44#ifndef NDEBUG
45 if (table->type != 2) {
46 fprintf(stderr, "KJS: Unknown hash table version.\n");
47 return 0;
48 }
49#endif
50 ASSERT(table->hashSize != 0);
51
52 hash %= table->hashSize;
53
54 const HashEntry *e = &table->entries[hash];
55
56 // empty bucket ?
57 if (!e->s)
58 return 0;
59
60 do {
61 // compare strings
62 if (keysMatch(c, len, e->s))
63 return e;
64
65 // try next bucket
66 e = e->next;
67 } while (e);
68 return 0;
69}
70
71const HashEntry* Lookup::findEntry(const struct HashTable *table,
72 const Identifier &s )
73{
74 const HashEntry* entry = ::findEntry(table, s.ustring().rep()->hash(), s.data(), s.size());
75 return entry;
76}
77
78int Lookup::find(const struct HashTable *table,
79 const UChar *c, unsigned int len)
80{
81 const HashEntry *entry = ::findEntry(table, UString::Rep::computeHash(c, len), c, len);
82 if (entry)
83 return entry->value;
84 return -1;
85}
86
87int Lookup::find(const struct HashTable *table, const Identifier &s)
88{
89 //printf("looking for:%s\n", s.ascii());
90 const HashEntry *entry = ::findEntry(table, s.ustring().rep()->hash(), s.data(), s.size());
91 if (entry)
92 return entry->value;
93 return -1;
94}
Note: See TracBrowser for help on using the repository browser.