Commit ee752e7d authored by darin@apple.com's avatar darin@apple.com

JavaScriptCore:

        Reviewed by Sam.

        - http://bugs.webkit.org/show_bug.cgi?id=15924
          next round of changes to JSRegExp (formerly PCRE)

        This is a combination of converting to C++, tweaking the API, and adding
        some additional optimizations.

        Future steps will involve getting rid of the use of UTF-8 completely
        (we'll use UTF-16 exclusively instead), eliminating more source files,
        and some more speed-ups.

        SunSpider says the current round is an 0.9% speed-up overall, and a
        5.3% speed-up for regexp.

        * JavaScriptCore.exp: Updated for new entry points.

        * JavaScriptCore.pri:
        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
        * JavaScriptCore.vcproj/dftables/dftables.vcproj:
        * JavaScriptCore.xcodeproj/project.pbxproj:
        * JavaScriptCoreSources.bkl:
        * jscore.bkl:
        Updated for new source file names and ForwardingHeaders.

        * kjs/regexp.cpp:
        (KJS::RegExp::RegExp): Changed to use the error message without calling
        strdup on it and to pass the new types and options.
        (KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
        (KJS::RegExp::match): Pass the new types and options.
        * kjs/regexp.h: Update type of m_constructionError.

        * pcre/AUTHORS: Update to reflect the status of the project -- we don't include
        the Google parts, and this isn't the PCRE library, per se.
        * pcre/COPYING: Ditto.

        * pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
        (main): Removed unneeded ctype_digit.

        * pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.

        * pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
        Moved a lot of private stuff used only within this file here from pcre_internal.h.
        Renumbered the error codes.
        (error_text): Use a single string with embedded nulls for the error text (I got
        this idea from newer versions of PCRE).
        (check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
        uses with isASCIIDigit.
        (is_counted_repeat): Ditto.
        (read_repeat_counts): Ditto.
        (first_significant_code): Ditto.
        (find_fixedlength): Ditto.
        (could_be_empty_branch): Ditto.
        (compile_branch): Ditto. Also removed some code that handles changing options.
        JavaScript doesn't have any of the features that allow options to change.
        (compile_regex): Updated for change to options parameter.
        (is_anchored): Ditto.
        (find_firstassertedchar): Ditto.
        (jsRegExpCompile): Changed to take separate flags instead of an options int.
        Also changed to call new/delete instead of pcre_malloc/free.
        (jsRegExpFree): Ditto.

        * pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
        Added a case that uses computed goto for the opcode loop, but did not turn it on.
        Changed the RMATCH macro to handle returns more efficiently by putting the where
        pointer in the new frame instead of the old one, allowing us to branch to the
        return with a single statement. Switched to new/delete from pcre_malloc/free.
        Changed many RRETURN callers to not set the return value since it's already
        set correctly. Replaced the rrc variable with an is_match variable. Values other
        than "match" and "no match" are now handled differently. This allows us to remove
        the code to check for those cases in various rules.
        (match): All the case statements use a macro BEGIN_OPCODE instead. And all the
        continue statements, or break statements that break out of the outer case use
        a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
        (jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
        start_match field from the match block.

        * pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
        in here. Removed various unused types. Converted from JSRegExpChar to UChar.
        Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
        used in multiple places. Unfortunately we lose the comments for each opcode; we
        should find a place to put those back. Removed ctype_digit.

        * pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
        (pcre_maketables): Got rid of the conditional code that allows this to be compiled
        in -- it's only used for dftables now (and soon may be obsolete entirely).
        Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
        loop. Removed ctype_digit.

        * pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.

        * pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
        Moved _pcre_OP_lengths out of here into pcre_exec.cpp.

        * pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
        Updated for other file name changes.

        * pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.

        * pcre/ucpinternal.h: Updated header.

        * pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.

        * wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
        & for this operation. Also added an overload that takes an int because that's
        useful for PCRE. Later we could optimize for int and overload other functions in
        this file; stuck to this simple one for now.

        * wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
        * wtf/unicode/qt4/UnicodeQt4.h: Ditto.

        * pcre/LICENCE: Removed.
        * pcre/pcre-config.h: Removed.
        * wtf/FastMallocPCRE.cpp: Removed.

        * pcre/dftables.c: Renamed to cpp.
        * pcre/pcre_compile.c: Ditto.
        * pcre/pcre_exec.c: Ditto.
        * pcre/pcre_maketables.c: Ditto.
        * pcre/pcre_ord2utf8.c: Ditto.
        * pcre/pcre_tables.c: Ditto.
        * pcre/pcre_ucp_searchfuncs.c: Ditto.
        * pcre/pcre_xclass.c: Ditto.
        * pcre/ucptable.c: Ditto.

WebCore:

        Reviewed by Sam.

        - updated for JSRegExp function changes

        * platform/RegularExpression.cpp:
        (WebCore::RegularExpression::Private::compile):
        (WebCore::RegularExpression::match):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27686 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 059734cf
2007-11-11 Darin Adler <darin@apple.com>
Reviewed by Sam.
- http://bugs.webkit.org/show_bug.cgi?id=15924
next round of changes to JSRegExp (formerly PCRE)
This is a combination of converting to C++, tweaking the API, and adding
some additional optimizations.
Future steps will involve getting rid of the use of UTF-8 completely
(we'll use UTF-16 exclusively instead), eliminating more source files,
and some more speed-ups.
SunSpider says the current round is an 0.9% speed-up overall, and a
5.3% speed-up for regexp.
* JavaScriptCore.exp: Updated for new entry points.
* JavaScriptCore.pri:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcproj/dftables/dftables.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* JavaScriptCoreSources.bkl:
* jscore.bkl:
Updated for new source file names and ForwardingHeaders.
* kjs/regexp.cpp:
(KJS::RegExp::RegExp): Changed to use the error message without calling
strdup on it and to pass the new types and options.
(KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
(KJS::RegExp::match): Pass the new types and options.
* kjs/regexp.h: Update type of m_constructionError.
* pcre/AUTHORS: Update to reflect the status of the project -- we don't include
the Google parts, and this isn't the PCRE library, per se.
* pcre/COPYING: Ditto.
* pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
(main): Removed unneeded ctype_digit.
* pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.
* pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
Moved a lot of private stuff used only within this file here from pcre_internal.h.
Renumbered the error codes.
(error_text): Use a single string with embedded nulls for the error text (I got
this idea from newer versions of PCRE).
(check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
uses with isASCIIDigit.
(is_counted_repeat): Ditto.
(read_repeat_counts): Ditto.
(first_significant_code): Ditto.
(find_fixedlength): Ditto.
(could_be_empty_branch): Ditto.
(compile_branch): Ditto. Also removed some code that handles changing options.
JavaScript doesn't have any of the features that allow options to change.
(compile_regex): Updated for change to options parameter.
(is_anchored): Ditto.
(find_firstassertedchar): Ditto.
(jsRegExpCompile): Changed to take separate flags instead of an options int.
Also changed to call new/delete instead of pcre_malloc/free.
(jsRegExpFree): Ditto.
* pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
Added a case that uses computed goto for the opcode loop, but did not turn it on.
Changed the RMATCH macro to handle returns more efficiently by putting the where
pointer in the new frame instead of the old one, allowing us to branch to the
return with a single statement. Switched to new/delete from pcre_malloc/free.
Changed many RRETURN callers to not set the return value since it's already
set correctly. Replaced the rrc variable with an is_match variable. Values other
than "match" and "no match" are now handled differently. This allows us to remove
the code to check for those cases in various rules.
(match): All the case statements use a macro BEGIN_OPCODE instead. And all the
continue statements, or break statements that break out of the outer case use
a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
(jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
start_match field from the match block.
* pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
in here. Removed various unused types. Converted from JSRegExpChar to UChar.
Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
used in multiple places. Unfortunately we lose the comments for each opcode; we
should find a place to put those back. Removed ctype_digit.
* pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
(pcre_maketables): Got rid of the conditional code that allows this to be compiled
in -- it's only used for dftables now (and soon may be obsolete entirely).
Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
loop. Removed ctype_digit.
* pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.
* pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
Moved _pcre_OP_lengths out of here into pcre_exec.cpp.
* pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
Updated for other file name changes.
* pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.
* pcre/ucpinternal.h: Updated header.
* pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.
* wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
& for this operation. Also added an overload that takes an int because that's
useful for PCRE. Later we could optimize for int and overload other functions in
this file; stuck to this simple one for now.
* wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
* wtf/unicode/qt4/UnicodeQt4.h: Ditto.
* pcre/LICENCE: Removed.
* pcre/pcre-config.h: Removed.
* wtf/FastMallocPCRE.cpp: Removed.
* pcre/dftables.c: Renamed to cpp.
* pcre/pcre_compile.c: Ditto.
* pcre/pcre_exec.c: Ditto.
* pcre/pcre_maketables.c: Ditto.
* pcre/pcre_ord2utf8.c: Ditto.
* pcre/pcre_tables.c: Ditto.
* pcre/pcre_ucp_searchfuncs.c: Ditto.
* pcre/pcre_xclass.c: Ditto.
* pcre/ucptable.c: Ditto.
2007-11-11 Eric Seidel <eric@webkit.org> 2007-11-11 Eric Seidel <eric@webkit.org>
Reviewed by Oliver. Reviewed by Oliver.
......
...@@ -101,6 +101,9 @@ __NPN_RetainObject ...@@ -101,6 +101,9 @@ __NPN_RetainObject
__NPN_SetException __NPN_SetException
__NPN_SetProperty __NPN_SetProperty
__NPN_UTF8FromIdentifier __NPN_UTF8FromIdentifier
__Z12jsRegExpFreeP8JSRegExp
__Z15jsRegExpCompilePKti24JSRegExpIgnoreCaseOption23JSRegExpMultilineOptionPjPPKc
__Z15jsRegExpExecutePK8JSRegExpPKtiiPii
__Z23_NPN_CreateScriptObjectP4_NPPPN3KJS8JSObjectEN3WTF10PassRefPtrINS1_8Bindings10RootObjectEEES8_ __Z23_NPN_CreateScriptObjectP4_NPPPN3KJS8JSObjectEN3WTF10PassRefPtrINS1_8Bindings10RootObjectEEES8_
__Z25_NPN_CreateNoScriptObjectv __Z25_NPN_CreateNoScriptObjectv
__ZN3KJS10Identifier11addSlowCaseEPNS_7UString3RepE __ZN3KJS10Identifier11addSlowCaseEPNS_7UString3RepE
...@@ -285,9 +288,6 @@ __ZTVN3KJS14StringInstanceE ...@@ -285,9 +288,6 @@ __ZTVN3KJS14StringInstanceE
__ZTVN3KJS15JSWrapperObjectE __ZTVN3KJS15JSWrapperObjectE
__ZTVN3KJS19InternalFunctionImpE __ZTVN3KJS19InternalFunctionImpE
__ZTVN3KJS8JSObjectE __ZTVN3KJS8JSObjectE
_jsRegExpCompile
_jsRegExpExecute
_jsRegExpFree
_jscore_collector_introspection _jscore_collector_introspection
_jscore_fastmalloc_introspection _jscore_fastmalloc_introspection
_kJSClassDefinitionEmpty _kJSClassDefinitionEmpty
......
...@@ -33,7 +33,6 @@ SOURCES += \ ...@@ -33,7 +33,6 @@ SOURCES += \
wtf/Assertions.cpp \ wtf/Assertions.cpp \
wtf/HashTable.cpp \ wtf/HashTable.cpp \
wtf/FastMalloc.cpp \ wtf/FastMalloc.cpp \
wtf/FastMallocPCRE.cpp \
bindings/NP_jsobject.cpp \ bindings/NP_jsobject.cpp \
bindings/npruntime.cpp \ bindings/npruntime.cpp \
bindings/runtime_array.cpp \ bindings/runtime_array.cpp \
......
...@@ -566,24 +566,16 @@ ...@@ -566,24 +566,16 @@
<Filter <Filter
Name="PCRE" Name="PCRE"
> >
<File
RelativePath="..\..\wtf\FastMallocPCRE.cpp"
>
</File>
<File
RelativePath="..\..\pcre\pcre-config.h"
>
</File>
<File <File
RelativePath="..\..\pcre\pcre.h" RelativePath="..\..\pcre\pcre.h"
> >
</File> </File>
<File <File
RelativePath="..\..\pcre\pcre_compile.c" RelativePath="..\..\pcre\pcre_compile.cpp"
> >
</File> </File>
<File <File
RelativePath="..\..\pcre\pcre_exec.c" RelativePath="..\..\pcre\pcre_exec.cpp"
> >
</File> </File>
<File <File
...@@ -591,19 +583,19 @@ ...@@ -591,19 +583,19 @@
> >
</File> </File>
<File <File
RelativePath="..\..\pcre\pcre_ord2utf8.c" RelativePath="..\..\pcre\pcre_ord2utf8.cpp"
> >
</File> </File>
<File <File
RelativePath="..\..\pcre\pcre_tables.c" RelativePath="..\..\pcre\pcre_tables.cpp"
> >
</File> </File>
<File <File
RelativePath="..\..\pcre\pcre_ucp_searchfuncs.c" RelativePath="..\..\pcre\pcre_ucp_searchfuncs.cpp"
> >
</File> </File>
<File <File
RelativePath="..\..\pcre\pcre_xclass.c" RelativePath="..\..\pcre\pcre_xclass.cpp"
> >
</File> </File>
<File <File
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="../../wtf" AdditionalIncludeDirectories="../../wtf;../..;&quot;$(WebKitLibrariesDir)\include\&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true" MinimalRebuild="true"
ExceptionHandling="0" ExceptionHandling="0"
......
...@@ -30,7 +30,6 @@ Source files for JSCore. ...@@ -30,7 +30,6 @@ Source files for JSCore.
--> -->
<makefile> <makefile>
<set append="1" var="JSCORE_SOURCES_API"> <set append="1" var="JSCORE_SOURCES_API">
API/JSBase.cpp API/JSBase.cpp
API/JSCallbackConstructor.cpp API/JSCallbackConstructor.cpp
API/JSCallbackFunction.cpp API/JSCallbackFunction.cpp
...@@ -40,11 +39,9 @@ Source files for JSCore. ...@@ -40,11 +39,9 @@ Source files for JSCore.
API/JSObjectRef.cpp API/JSObjectRef.cpp
API/JSStringRef.cpp API/JSStringRef.cpp
API/JSValueRef.cpp API/JSValueRef.cpp
</set> </set>
<set append="1" var="JSCORE_SOURCES_BINDINGS"> <set append="1" var="JSCORE_SOURCES_BINDINGS">
bindings/c/c_class.cpp bindings/c/c_class.cpp
bindings/c/c_instance.cpp bindings/c/c_instance.cpp
bindings/c/c_runtime.cpp bindings/c/c_runtime.cpp
...@@ -56,7 +53,6 @@ Source files for JSCore. ...@@ -56,7 +53,6 @@ Source files for JSCore.
bindings/runtime_method.cpp bindings/runtime_method.cpp
bindings/runtime_object.cpp bindings/runtime_object.cpp
bindings/runtime_root.cpp bindings/runtime_root.cpp
</set> </set>
<set append="1" var="JSCORE_SOURCES_KJS"> <set append="1" var="JSCORE_SOURCES_KJS">
...@@ -104,18 +100,17 @@ Source files for JSCore. ...@@ -104,18 +100,17 @@ Source files for JSCore.
</set> </set>
<set append="1" var="JSCORE_SOURCES_PCRE"> <set append="1" var="JSCORE_SOURCES_PCRE">
pcre/pcre_compile.c pcre/pcre_compile.cpp
pcre/pcre_exec.c pcre/pcre_exec.cpp
pcre/pcre_ord2utf8.c pcre/pcre_ord2utf8.cpp
pcre/pcre_tables.c pcre/pcre_tables.cpp
pcre/pcre_ucp_searchfuncs.c pcre/pcre_ucp_searchfuncs.cpp
pcre/pcre_xclass.c pcre/pcre_xclass.cpp
</set> </set>
<set append="1" var="WTF_SOURCES"> <set append="1" var="WTF_SOURCES">
wtf/Assertions.cpp wtf/Assertions.cpp
wtf/FastMalloc.cpp wtf/FastMalloc.cpp
wtf/FastMallocPCRE.cpp
wtf/HashTable.cpp wtf/HashTable.cpp
wtf/TCSystemAlloc.cpp wtf/TCSystemAlloc.cpp
</set> </set>
......
...@@ -106,7 +106,7 @@ JavaScriptCore Bakefile project file. ...@@ -106,7 +106,7 @@ JavaScriptCore Bakefile project file.
<exe id="dftables"> <exe id="dftables">
<dirname>$(SRCDIR)</dirname> <dirname>$(SRCDIR)</dirname>
<include>$(SRCDIR)/wtf</include> <include>$(SRCDIR)/wtf</include>
<sources>$(SRCDIR)/pcre/dftables.c</sources> <sources>$(SRCDIR)/pcre/dftables.cpp</sources>
</exe> </exe>
<action id="DerivedSources"> <action id="DerivedSources">
......
...@@ -37,10 +37,8 @@ RegExp::RegExp(const UString& pattern) ...@@ -37,10 +37,8 @@ RegExp::RegExp(const UString& pattern)
, m_constructionError(0) , m_constructionError(0)
, m_numSubpatterns(0) , m_numSubpatterns(0)
{ {
const char* errorMessage; m_regExp = jsRegExpCompile(reinterpret_cast<const ::UChar*>(m_pattern.data()), m_pattern.size(),
m_regExp = jsRegExpCompile(reinterpret_cast<const JSRegExpChar*>(m_pattern.data()), m_pattern.size(), 0, &m_numSubpatterns, &errorMessage); JSRegExpDoNotIgnoreCase, JSRegExpSingleLine, &m_numSubpatterns, &m_constructionError);
if (!m_regExp)
m_constructionError = strdup(errorMessage);
} }
RegExp::RegExp(const UString& pattern, const UString& flags) RegExp::RegExp(const UString& pattern, const UString& flags)
...@@ -55,28 +53,26 @@ RegExp::RegExp(const UString& pattern, const UString& flags) ...@@ -55,28 +53,26 @@ RegExp::RegExp(const UString& pattern, const UString& flags)
if (flags.find('g') != -1) if (flags.find('g') != -1)
m_flags |= Global; m_flags |= Global;
// FIXME: Eliminate duplication by adding a way ask a JSRegExp what its flags are. // FIXME: Eliminate duplication by adding a way ask a JSRegExp what its flags are?
int options = 0; JSRegExpIgnoreCaseOption ignoreCaseOption = JSRegExpDoNotIgnoreCase;
if (flags.find('i') != -1) { if (flags.find('i') != -1) {
m_flags |= IgnoreCase; m_flags |= IgnoreCase;
options |= JS_REGEXP_CASELESS; ignoreCaseOption = JSRegExpIgnoreCase;
} }
JSRegExpMultilineOption multilineOption = JSRegExpSingleLine;
if (flags.find('m') != -1) { if (flags.find('m') != -1) {
m_flags |= Multiline; m_flags |= Multiline;
options |= JS_REGEXP_MULTILINE; multilineOption = JSRegExpMultiline;
} }
const char* errorMessage; m_regExp = jsRegExpCompile(reinterpret_cast<const ::UChar*>(m_pattern.data()), m_pattern.size(),
m_regExp = jsRegExpCompile(reinterpret_cast<const JSRegExpChar*>(m_pattern.data()), m_pattern.size(), options, &m_numSubpatterns, &errorMessage); ignoreCaseOption, multilineOption, &m_numSubpatterns, &m_constructionError);
if (!m_regExp)
m_constructionError = strdup(errorMessage);
} }
RegExp::~RegExp() RegExp::~RegExp()
{ {
jsRegExpFree(m_regExp); jsRegExpFree(m_regExp);
free(m_constructionError);
} }
int RegExp::match(const UString& s, int i, OwnArrayPtr<int>* ovector) int RegExp::match(const UString& s, int i, OwnArrayPtr<int>* ovector)
...@@ -106,11 +102,11 @@ int RegExp::match(const UString& s, int i, OwnArrayPtr<int>* ovector) ...@@ -106,11 +102,11 @@ int RegExp::match(const UString& s, int i, OwnArrayPtr<int>* ovector)
ovector->set(offsetVector); ovector->set(offsetVector);
} }
int numMatches = jsRegExpExecute(m_regExp, reinterpret_cast<const JSRegExpChar*>(s.data()), s.size(), i, offsetVector, offsetVectorSize); int numMatches = jsRegExpExecute(m_regExp, reinterpret_cast<const ::UChar*>(s.data()), s.size(), i, offsetVector, offsetVectorSize);
if (numMatches < 0) { if (numMatches < 0) {
#ifndef NDEBUG #ifndef NDEBUG
if (numMatches != JS_REGEXP_ERROR_NOMATCH) if (numMatches != JSRegExpErrorNoMatch)
fprintf(stderr, "KJS: pcre_exec() failed with result %d\n", numMatches); fprintf(stderr, "KJS: pcre_exec() failed with result %d\n", numMatches);
#endif #endif
if (ovector) if (ovector)
......
...@@ -68,7 +68,7 @@ namespace KJS { ...@@ -68,7 +68,7 @@ namespace KJS {
// Data supplied by PCRE. // Data supplied by PCRE.
JSRegExp* m_regExp; JSRegExp* m_regExp;
char* m_constructionError; const char* m_constructionError;
unsigned m_numSubpatterns; unsigned m_numSubpatterns;
}; };
......
THE MAIN PCRE LIBRARY Originally written by: Philip Hazel
--------------------- Email local part: ph10
Email domain: cam.ac.uk
Written by: Philip Hazel
Email local part: ph10
Email domain: cam.ac.uk
University of Cambridge Computing Service, University of Cambridge Computing Service,
Cambridge, England. Phone: +44 1223 334714. Cambridge, England. Phone: +44 1223 334714.
Copyright (c) 1997-2005 University of Cambridge Copyright (c) 1997-2005 University of Cambridge. All rights reserved.
All rights reserved
UTF-16 changes by Darin Adler and Geoff Garen
Copyright (c) 2005, 2006, 2007 Apple Inc.
All rights reserved
THE C++ WRAPPER LIBRARY
-----------------------
Written by: Google Inc.
Copyright (c) 2005 Google Inc Adapted for JavaScriptCore and WebKit by Apple Inc.
All rights reserved
#### Copyright (c) 2005, 2006, 2007 Apple Inc. All rights reserved.
PCRE LICENCE
------------
PCRE is a library of functions to support regular expressions whose syntax PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language. and semantics are as close as possible to those of the Perl 5 language.
Release 6 of PCRE is distributed under the terms of the "BSD" licence, as This is JavaScriptCore's variant of the PCRE library. While this library
specified below. The documentation for PCRE, supplied in the "doc" started out as a copy of PCRE, many of the features of PCRE have been
directory, is distributed under the same terms as the software itself. removed.
The basic library functions are written in C and are freestanding. Also
included in the distribution is a set of C++ wrapper functions.
THE BASIC LIBRARY FUNCTIONS
---------------------------
Written by: Philip Hazel
Email local part: ph10
Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England. Phone: +44 1223 334714.
Copyright (c) 1997-2005 University of Cambridge
All rights reserved.
Copyright (c) 1997-2005 University of Cambridge. All rights reserved.
THE C++ WRAPPER FUNCTIONS
-------------------------
Contributed by: Google Inc.
Copyright (c) 2005, Google Inc.
All rights reserved.
THE "BSD" LICENCE
-----------------
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: modification, are permitted provided that the following conditions are met:
...@@ -48,7 +17,7 @@ modification, are permitted provided that the following conditions are met: ...@@ -48,7 +17,7 @@ modification, are permitted provided that the following conditions are met:
notice, this list of conditions and the following disclaimer in the notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution. documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge nor the name of Google * Neither the name of the University of Cambridge nor the name of Apple
Inc. nor the names of their contributors may be used to endorse or Inc. nor the names of their contributors may be used to endorse or
promote products derived from this software without specific prior promote products derived from this software without specific prior
written permission. written permission.
...@@ -64,5 +33,3 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ...@@ -64,5 +33,3 @@ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
End
PCRE LICENCE
------------
PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Release 6 of PCRE is distributed under the terms of the "BSD" licence, as
specified below. The documentation for PCRE, supplied in the "doc"
directory, is distributed under the same terms as the software itself.
The basic library functions are written in C and are freestanding. Also
included in the distribution is a set of C++ wrapper functions.
THE BASIC LIBRARY FUNCTIONS
---------------------------
Written by: Philip Hazel
Email local part: ph10
Email domain: cam.ac.uk
University of Cambridge Computing Service,
Cambridge, England. Phone: +44 1223 334714.
Copyright (c) 1997-2006 University of Cambridge
All rights reserved.
THE C++ WRAPPER FUNCTIONS
-------------------------
Contributed by: Google Inc.
Copyright (c) 2005, Google Inc.
All rights reserved.
THE "BSD" LICENCE
-----------------
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the University of Cambridge nor the name of Google
Inc. nor the names of their contributors may be used to endorse or
promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
End