summaryrefslogtreecommitdiffstats
path: root/kjs
diff options
context:
space:
mode:
Diffstat (limited to 'kjs')
-rw-r--r--kjs/CMakeLists.txt7
-rw-r--r--kjs/Mainpage.dox2
-rw-r--r--kjs/Makefile.am6
-rw-r--r--kjs/array_instance.h1
-rw-r--r--kjs/array_object.cpp1
-rw-r--r--kjs/array_object.h1
-rw-r--r--kjs/bool_object.cpp1
-rw-r--r--kjs/bool_object.h1
-rw-r--r--kjs/collector.cpp1
-rw-r--r--kjs/collector.h1
-rw-r--r--kjs/completion.h1
-rw-r--r--kjs/configure.in.in51
-rw-r--r--kjs/context.h1
-rw-r--r--kjs/date_object.cpp12
-rw-r--r--kjs/date_object.h1
-rw-r--r--kjs/debugger.cpp1
-rw-r--r--kjs/debugger.h1
-rw-r--r--kjs/dtoa.cpp6
-rw-r--r--kjs/dtoa.h1
-rw-r--r--kjs/error_object.cpp1
-rw-r--r--kjs/error_object.h1
-rw-r--r--kjs/function.cpp1
-rw-r--r--kjs/function.h1
-rw-r--r--kjs/function_object.cpp1
-rw-r--r--kjs/function_object.h1
-rw-r--r--kjs/global.h.in5
-rw-r--r--kjs/grammar.cpp2
-rw-r--r--kjs/internal.cpp1
-rw-r--r--kjs/internal.h1
-rw-r--r--kjs/interpreter.cpp1
-rw-r--r--kjs/interpreter.h1
-rw-r--r--kjs/lexer.cpp1
-rw-r--r--kjs/lexer.h1
-rw-r--r--kjs/lookup.cpp1
-rw-r--r--kjs/lookup.h1
-rw-r--r--kjs/math_object.cpp1
-rw-r--r--kjs/math_object.h1
-rw-r--r--kjs/nodes.cpp1
-rw-r--r--kjs/nodes.h1
-rw-r--r--kjs/nodes2string.cpp1
-rw-r--r--kjs/number_object.cpp1
-rw-r--r--kjs/number_object.h1
-rw-r--r--kjs/object.cpp1
-rw-r--r--kjs/object.h1
-rw-r--r--kjs/object_object.cpp1
-rw-r--r--kjs/object_object.h1
-rw-r--r--kjs/operations.cpp1
-rw-r--r--kjs/operations.h1
-rw-r--r--kjs/property_map.h1
-rw-r--r--kjs/reference.cpp1
-rw-r--r--kjs/reference.h1
-rw-r--r--kjs/reference_list.cpp1
-rw-r--r--kjs/reference_list.h1
-rw-r--r--kjs/regexp.cpp231
-rw-r--r--kjs/regexp.h23
-rw-r--r--kjs/regexp_object.cpp1
-rw-r--r--kjs/regexp_object.h1
-rw-r--r--kjs/simple_number.h1
-rw-r--r--kjs/string_object.cpp6
-rw-r--r--kjs/string_object.h1
-rw-r--r--kjs/testkjs.cpp1
-rw-r--r--kjs/types.h1
-rw-r--r--kjs/ustring.cpp1
-rw-r--r--kjs/ustring.h1
-rw-r--r--kjs/value.cpp6
-rw-r--r--kjs/value.h1
66 files changed, 170 insertions, 241 deletions
diff --git a/kjs/CMakeLists.txt b/kjs/CMakeLists.txt
index e8530ea58..c74bf1d5b 100644
--- a/kjs/CMakeLists.txt
+++ b/kjs/CMakeLists.txt
@@ -15,12 +15,12 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/tdecore
- ${LIBPCRE_INCLUDEDIR}
+ ${LIBPCRE2_INCLUDEDIR}
)
link_directories(
${TDECORE_LIBRARY_DIRS}
- ${LIBPCRE_LIBDIR}
+ ${LIBPCRE2_LIBDIR}
)
@@ -61,6 +61,7 @@ tde_add_lut( keywords.table lexer.lut.h lexer.cpp )
tde_add_library( ${target} SHARED
SOURCES ${${target}_SRCS}
VERSION 1.2.0
- LINK tdecore-shared ${LIBPCRE_LIBRARIES}
+ LINK tdecore-shared
+ LINK_PRIVATE ${LIBPCRE2_LIBRARIES}
DESTINATION ${LIB_INSTALL_DIR}
)
diff --git a/kjs/Mainpage.dox b/kjs/Mainpage.dox
index 30a003b2e..b455b4226 100644
--- a/kjs/Mainpage.dox
+++ b/kjs/Mainpage.dox
@@ -26,5 +26,3 @@ Harri Porten \<porten@kde.org\>
// DOXYGEN_SET_PROJECT_NAME = KJS
// DOXYGEN_SET_EXCLUDE_PATTERNS += */wtf/*
// DOXYGEN_SET_EXCLUDE_PATTERNS += */kjs/*.cpp */kjs/*.h
-
-// vim:ts=4:sw=4:expandtab:filetype=doxygen
diff --git a/kjs/Makefile.am b/kjs/Makefile.am
index 89f937906..8dc05f656 100644
--- a/kjs/Makefile.am
+++ b/kjs/Makefile.am
@@ -17,7 +17,7 @@
# Boston, MA 02110-1301, USA.
YACC = bison
-INCLUDES = $(PCRECFLAGS) $(all_includes)
+INCLUDES = $(PCRE2CFLAGS) $(all_includes)
lib_LTLIBRARIES = libkjs.la
@@ -50,7 +50,7 @@ endif
libkjs_la_LDFLAGS = -version-info 3:0:2 -no-undefined $(VSCRIPT) \
$(USER_LDFLAGS) $(all_libraries)
-libkjs_la_LIBADD = -lm $(LIBPCRE)
+libkjs_la_LIBADD = -lm $(LIBPCRE2)
EXTRA_DIST = grammar.y
@@ -93,7 +93,7 @@ CLEANFILES = $(LUT_FILES)
## test program (in one program for easier profiling/memory debugging)
EXTRA_PROGRAMS = testkjs_static
testkjs_static_SOURCES = testkjs.cpp
-testkjs_static_LDADD = $(LIBPCRE) libkjs.la
+testkjs_static_LDADD = $(LIBPCRE2) libkjs.la
testkjs_static_LDFLAGS = -static
## test program (linked to libkjs)
diff --git a/kjs/array_instance.h b/kjs/array_instance.h
index 2c2db0e0c..2312c0a20 100644
--- a/kjs/array_instance.h
+++ b/kjs/array_instance.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/array_object.cpp b/kjs/array_object.cpp
index de49e4164..a73b0cab7 100644
--- a/kjs/array_object.cpp
+++ b/kjs/array_object.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/array_object.h b/kjs/array_object.h
index f25340177..f83e04171 100644
--- a/kjs/array_object.h
+++ b/kjs/array_object.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/bool_object.cpp b/kjs/bool_object.cpp
index 5462a46c2..c6a9c51ab 100644
--- a/kjs/bool_object.cpp
+++ b/kjs/bool_object.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/bool_object.h b/kjs/bool_object.h
index 0fd87336a..47542a799 100644
--- a/kjs/bool_object.h
+++ b/kjs/bool_object.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/collector.cpp b/kjs/collector.cpp
index 2f7e0faa6..20b3930a4 100644
--- a/kjs/collector.cpp
+++ b/kjs/collector.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2003 Apple Computer, Inc.
diff --git a/kjs/collector.h b/kjs/collector.h
index 439c14850..284bd5684 100644
--- a/kjs/collector.h
+++ b/kjs/collector.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/completion.h b/kjs/completion.h
index 009ced476..f7674f62f 100644
--- a/kjs/completion.h
+++ b/kjs/completion.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
diff --git a/kjs/configure.in.in b/kjs/configure.in.in
index 1c4d3ac52..4e6bd9742 100644
--- a/kjs/configure.in.in
+++ b/kjs/configure.in.in
@@ -2,52 +2,55 @@ dnl KDE JavaScript specific configure tests
AC_CHECK_HEADERS(ieeefp.h float.h)
-AC_DEFUN([AC_CHECK_PCREPOSIX],
+AC_DEFUN(AC_CHECK_PCRE2POSIX],
[
- dnl define the configure option that disables pcre
- AC_ARG_ENABLE(pcre,AC_HELP_STRING([--disable-pcre],[don't require libpcre (poor RegExp support in Javascript)]),
- with_pcre=$enableval, with_pcre=yes)
+ dnl define the configure option that disables pcre2
+ AC_ARG_ENABLE(pcre2,AC_HELP_STRING([--disable-pcre],[don't require libpcre (poor RegExp support in Javascript)]),
+ with_pcre2=$enableval, with_pcre2=yes)
- if test "$with_pcre" = "yes"; then
+ if test "$with_pcre2" = "yes"; then
- KDE_FIND_PATH(pcre-config, PCRE_CONFIG, [${exec_prefix}/bin ${prefix}/bin], [PCRE_CONFIG="" ])
- if test -n "$PCRE_CONFIG" && $PCRE_CONFIG --libs >/dev/null 2>&1; then
- LIBPCRE=`$PCRE_CONFIG --libs-posix | sed -e "s,-L/usr/lib ,," -e "s,[\b-].\+pcreposix[^[:space:]]*\b,,"`
- PCRECFLAGS=`$PCRE_CONFIG --cflags`
+ KDE_FIND_PATH(pcre2-config, PCRE2_CONFIG, [${exec_prefix}/bin ${prefix}/bin], [PCRE2_CONFIG="" ])
+ if test -n "$PCRE2_CONFIG" && $PCRE2_CONFIG --libs8 >/dev/null 2>&1; then
+ LIBPCRE2=`$PCRE2_CONFIG --libs-posix | sed -e "s,-L/usr/lib ,," -e "s,[\b-].\+pcreposix[^[:space:]]*\b,,"`
+ PCRE2CFLAGS=`$PCRE2_CONFIG --cflags`
else
- LIBPCRE="-lpcre"
- PCRECFLAGS=
+ LIBPCRE2="-lpcre2-8"
+ PCRE2CFLAGS=
fi
- AC_CACHE_VAL(ac_cv_have_pcreposix, [
+ AC_CACHE_VAL(ac_cv_have_pcre2posix, [
ac_save_libs="$LIBS"
- LIBS="$LIBPCRE"
+ LIBS="$LIBPCRE2"
ac_CPPFLAGS_save="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $PCRECFLAGS $all_includes"
+ CPPFLAGS="$CPPFLAGS $PCRE2CFLAGS $all_includes"
ac_LDFLAGS_save="$LDFLAGS"
LDFLAGS="$LDFLAGS $all_libraries"
AC_TRY_LINK(
- [#include <pcre.h>],
- [regfree(0);],
- [ac_cv_have_pcreposix="yes"],
- [ac_cv_have_pcreposix="no"]
+ [
+ #define PCRE2_CODE_UNIT_WIDTH 8
+ #include <pcre2.h>
+ ],
+ [pcre2_regfree(0);],
+ [ac_cv_have_pcre2posix="yes"],
+ [ac_cv_have_pcre2posix="no"]
)
LIBS="$ac_save_libs"
LDFLAGS="$ac_LDFLAGS_save"
CPPFLAGS="$ac_CPPFLAGS_save"
])
- if test "$ac_cv_have_pcreposix" = "yes"; then
- AC_DEFINE(HAVE_PCREPOSIX, 1, [Define if you have pcreposix libraries and header files.])
+ if test "$ac_cv_have_pcre2posix" = "yes"; then
+ AC_DEFINE(HAVE_PCRE2POSIX, 1, [Define if you have pcre2posix libraries and header files.])
else
AC_MSG_ERROR([You're missing libpcre.
-Download libpcre from http://www.pcre.org or find a binary package for your platform.
+Download libpcre2 from http://www.pcre.org or find a binary package for your platform.
Alternatively, you can specify --disable-pcre, but some web pages - using regular
expressions in Javascript code - will not work correctly, the regexp support being
quite limited if libpcre isn't present.])
fi
fi
])
-AC_CHECK_PCREPOSIX
-AC_SUBST(LIBPCRE)
-AC_SUBST(PCRECFLAGS)
+AC_CHECK_PCRE2POSIX
+AC_SUBST(LIBPCRE2)
+AC_SUBST(PCRE2CFLAGS)
AM_CONFIG_HEADER([kjs/global.h])
diff --git a/kjs/context.h b/kjs/context.h
index 1b435798e..a6ca373e1 100644
--- a/kjs/context.h
+++ b/kjs/context.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
diff --git a/kjs/date_object.cpp b/kjs/date_object.cpp
index ff5209bb3..97c272baf 100644
--- a/kjs/date_object.cpp
+++ b/kjs/date_object.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2005 Harri Porten (porten@kde.org)
@@ -105,7 +104,7 @@ static UString formatTime(struct tm &tm)
#if defined BSD || defined(__linux__) || defined(__APPLE__)
tz = tm.tm_gmtoff;
#else
-# if defined(__BORLANDC__) || defined (__CYGWIN__)
+# if defined (__CYGWIN__)
tz = - _timezone;
# else
tz = - timezone;
@@ -190,7 +189,7 @@ static double timeZoneOffset(const struct tm *t)
#if defined BSD || defined(__linux__) || defined(__APPLE__)
return -(t->tm_gmtoff / 60);
#else
-# if defined(__BORLANDC__) || defined(__CYGWIN__)
+# if defined(__CYGWIN__)
// FIXME consider non one-hour DST change
#if !defined(__CYGWIN__)
#error please add daylight savings offset here!
@@ -627,13 +626,8 @@ Object DateObjectImp::construct(ExecState *exec, const List &args)
if (numArgs == 0) { // new Date() ECMA 15.9.3.3
#ifdef HAVE_SYS_TIMEB_H
-# if defined(__BORLANDC__)
- struct timeb timebuffer;
- ftime(&timebuffer);
-# else
struct _timeb timebuffer;
_ftime(&timebuffer);
-# endif
double utc = floor((double)timebuffer.time * 1000.0 + (double)timebuffer.millitm);
#else
struct timeval tv;
@@ -806,7 +800,7 @@ double KJS::makeTime(struct tm *t, double ms, bool utc)
t->tm_isdst = t3.tm_isdst;
#else
(void)localtime(&zero);
-# if defined(__BORLANDC__) || defined(__CYGWIN__)
+# if defined(__CYGWIN__)
utcOffset = - _timezone;
# else
utcOffset = - timezone;
diff --git a/kjs/date_object.h b/kjs/date_object.h
index d432b4472..aa2449f18 100644
--- a/kjs/date_object.h
+++ b/kjs/date_object.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/debugger.cpp b/kjs/debugger.cpp
index 4632cc7bf..6eec02c87 100644
--- a/kjs/debugger.cpp
+++ b/kjs/debugger.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
diff --git a/kjs/debugger.h b/kjs/debugger.h
index d30b570e8..c3b6f1a63 100644
--- a/kjs/debugger.h
+++ b/kjs/debugger.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
diff --git a/kjs/dtoa.cpp b/kjs/dtoa.cpp
index c39fa5bc6..8fc79ddf7 100644
--- a/kjs/dtoa.cpp
+++ b/kjs/dtoa.cpp
@@ -2077,7 +2077,7 @@ strtod
else if (!(word0(rv) & Bndry_mask) && !word1(rv)) {
drop_down:
/* boundary case -- decrement exponent */
-#ifdef Sudden_Underflow /*{{*/
+#ifdef Sudden_Underflow
L = word0(rv) & Exp_mask;
#ifdef IBM
if (L < Exp_msk1)
@@ -2086,8 +2086,8 @@ strtod
if (L <= (scale ? (2*P+1)*Exp_msk1 : Exp_msk1))
#else
if (L <= Exp_msk1)
-#endif /*Avoid_Underflow*/
-#endif /*IBM*/
+#endif
+#endif
goto undfl;
L -= Exp_msk1;
#else /*Sudden_Underflow}{*/
diff --git a/kjs/dtoa.h b/kjs/dtoa.h
index 188a4878f..a35807bca 100644
--- a/kjs/dtoa.h
+++ b/kjs/dtoa.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2003 Apple Computer, Inc.
diff --git a/kjs/error_object.cpp b/kjs/error_object.cpp
index 1b2451489..8eff59db2 100644
--- a/kjs/error_object.cpp
+++ b/kjs/error_object.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/error_object.h b/kjs/error_object.h
index 21fd84f14..bd3f38a03 100644
--- a/kjs/error_object.h
+++ b/kjs/error_object.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/function.cpp b/kjs/function.cpp
index ef5410cf8..92743b4f9 100644
--- a/kjs/function.cpp
+++ b/kjs/function.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
diff --git a/kjs/function.h b/kjs/function.h
index 777e7d177..71c46bb4a 100644
--- a/kjs/function.h
+++ b/kjs/function.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/function_object.cpp b/kjs/function_object.cpp
index 83b62aa09..a5f2151aa 100644
--- a/kjs/function_object.cpp
+++ b/kjs/function_object.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
diff --git a/kjs/function_object.h b/kjs/function_object.h
index d5b7a281f..96b14f383 100644
--- a/kjs/function_object.h
+++ b/kjs/function_object.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/global.h.in b/kjs/global.h.in
index bd8d46b81..a9efbfc8e 100644
--- a/kjs/global.h.in
+++ b/kjs/global.h.in
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2002 David Faure (david@mandrakesoft.com)
@@ -34,9 +33,9 @@
#define KJS_PACKED
#endif
-#cmakedefine __KDE_HAVE_GCC_VISIBILITY 1
+#cmakedefine __TDE_HAVE_GCC_VISIBILITY 1
-#ifdef __KDE_HAVE_GCC_VISIBILITY
+#ifdef __TDE_HAVE_GCC_VISIBILITY
#define KJS_EXPORT __attribute__ ((visibility("default")))
#else
#define KJS_EXPORT
diff --git a/kjs/grammar.cpp b/kjs/grammar.cpp
index 03eb07876..9cc7a342f 100644
--- a/kjs/grammar.cpp
+++ b/kjs/grammar.cpp
@@ -1340,7 +1340,9 @@ while (0)
# define YYDPRINTF(Args) \
do { \
if (yydebug) \
+ { \
YYFPRINTF Args; \
+ } \
} while (0)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
diff --git a/kjs/internal.cpp b/kjs/internal.cpp
index 3ab0b9de2..c154bcd7f 100644
--- a/kjs/internal.cpp
+++ b/kjs/internal.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2002 Harri Porten (porten@kde.org)
diff --git a/kjs/internal.h b/kjs/internal.h
index 413fdaa52..cfba61e5b 100644
--- a/kjs/internal.h
+++ b/kjs/internal.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
diff --git a/kjs/interpreter.cpp b/kjs/interpreter.cpp
index 8d4a7eca7..eb76f87e1 100644
--- a/kjs/interpreter.cpp
+++ b/kjs/interpreter.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
diff --git a/kjs/interpreter.h b/kjs/interpreter.h
index e8f4f84f3..9b1f0cd9d 100644
--- a/kjs/interpreter.h
+++ b/kjs/interpreter.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
diff --git a/kjs/lexer.cpp b/kjs/lexer.cpp
index 054defb88..9c304dd8b 100644
--- a/kjs/lexer.cpp
+++ b/kjs/lexer.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/lexer.h b/kjs/lexer.h
index c6cb6aa88..4a10285b0 100644
--- a/kjs/lexer.h
+++ b/kjs/lexer.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/lookup.cpp b/kjs/lookup.cpp
index 899238949..7bf6bd738 100644
--- a/kjs/lookup.cpp
+++ b/kjs/lookup.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/lookup.h b/kjs/lookup.h
index a77b0b633..e605cbbfb 100644
--- a/kjs/lookup.h
+++ b/kjs/lookup.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/math_object.cpp b/kjs/math_object.cpp
index be4943319..51bf9632d 100644
--- a/kjs/math_object.cpp
+++ b/kjs/math_object.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/math_object.h b/kjs/math_object.h
index ff4b1f9d6..673ad953f 100644
--- a/kjs/math_object.h
+++ b/kjs/math_object.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/nodes.cpp b/kjs/nodes.cpp
index 6bb6cfaae..80d530204 100644
--- a/kjs/nodes.cpp
+++ b/kjs/nodes.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2002, 2003 Harri Porten (porten@kde.org)
diff --git a/kjs/nodes.h b/kjs/nodes.h
index 4f7e10d36..bcbfd7f6d 100644
--- a/kjs/nodes.h
+++ b/kjs/nodes.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000, 2003 Harri Porten (porten@kde.org)
diff --git a/kjs/nodes2string.cpp b/kjs/nodes2string.cpp
index 25ec0d712..73612636a 100644
--- a/kjs/nodes2string.cpp
+++ b/kjs/nodes2string.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2002 Harri Porten (porten@kde.org)
diff --git a/kjs/number_object.cpp b/kjs/number_object.cpp
index 0d6698142..4d5a95cd5 100644
--- a/kjs/number_object.cpp
+++ b/kjs/number_object.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/number_object.h b/kjs/number_object.h
index b48d3c3c0..31c48804a 100644
--- a/kjs/number_object.h
+++ b/kjs/number_object.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/object.cpp b/kjs/object.cpp
index 9afdb6c35..d56a72458 100644
--- a/kjs/object.cpp
+++ b/kjs/object.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
diff --git a/kjs/object.h b/kjs/object.h
index ca795460c..143cdcb6d 100644
--- a/kjs/object.h
+++ b/kjs/object.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
diff --git a/kjs/object_object.cpp b/kjs/object_object.cpp
index e17835df6..6d6651602 100644
--- a/kjs/object_object.cpp
+++ b/kjs/object_object.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/object_object.h b/kjs/object_object.h
index c3192107d..20eb643bd 100644
--- a/kjs/object_object.h
+++ b/kjs/object_object.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/operations.cpp b/kjs/operations.cpp
index b9314eccb..2aff8f7ad 100644
--- a/kjs/operations.cpp
+++ b/kjs/operations.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/operations.h b/kjs/operations.h
index 4579b11dc..1f7d5d30e 100644
--- a/kjs/operations.h
+++ b/kjs/operations.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/property_map.h b/kjs/property_map.h
index 4b1398e7b..8b0819fa5 100644
--- a/kjs/property_map.h
+++ b/kjs/property_map.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2003 Apple Computer, Inc.
diff --git a/kjs/reference.cpp b/kjs/reference.cpp
index 778db8a53..be37b1d33 100644
--- a/kjs/reference.cpp
+++ b/kjs/reference.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2003 Apple Computer, Inc
diff --git a/kjs/reference.h b/kjs/reference.h
index eafa39848..ccdc6ec88 100644
--- a/kjs/reference.h
+++ b/kjs/reference.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2003 Apple Computer, Inc
diff --git a/kjs/reference_list.cpp b/kjs/reference_list.cpp
index d60fbd260..b85d93b77 100644
--- a/kjs/reference_list.cpp
+++ b/kjs/reference_list.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2003 Apple Computer, Inc
diff --git a/kjs/reference_list.h b/kjs/reference_list.h
index 20293a736..a18aaa9d5 100644
--- a/kjs/reference_list.h
+++ b/kjs/reference_list.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2003 Apple Computer, Inc
diff --git a/kjs/regexp.cpp b/kjs/regexp.cpp
index e4db2b956..04159904f 100644
--- a/kjs/regexp.cpp
+++ b/kjs/regexp.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
@@ -31,19 +30,19 @@
using namespace KJS;
-#ifdef PCRE_CONFIG_UTF8
+#ifdef HAVE_PCRE2POSIX
RegExp::UTF8SupportState RegExp::utf8Support = RegExp::Unknown;
#endif
RegExp::RegExp(const UString &p, int f)
: pat(p), flgs(f), m_notEmpty(false), valid(true), buffer(0), originalPos(0)
{
+#ifdef HAVE_PCRE2POSIX
// Determine whether libpcre has unicode support if need be..
-#ifdef PCRE_CONFIG_UTF8
if (utf8Support == Unknown) {
- int supported;
- pcre_config(PCRE_CONFIG_UTF8, (void*)&supported);
- utf8Support = supported ? Supported : Unsupported;
+ uint32_t supported;
+ pcre2_config(PCRE2_CONFIG_COMPILED_WIDTHS, (void*)&supported);
+ utf8Support = (supported & 0x0001) ? Supported : Unsupported;
}
#endif
@@ -64,33 +63,33 @@ RegExp::RegExp(const UString &p, int f)
escape = false;
// we only care about \u
if (c == 'u') {
- // standard unicode escape sequence looks like \uxxxx but
- // other browsers also accept less then 4 hex digits
- unsigned short u = 0;
- int j = 0;
- for (j = 0; j < 4; ++j) {
- if (i + 1 < p.size() && Lexer::isHexDigit(p[i + 1].unicode())) {
- u = (u << 4) + Lexer::convertHex(p[i + 1].unicode());
- ++i;
- } else {
- // sequence incomplete. restore index.
- // TODO: cleaner way to propagate warning
- fprintf(stderr, "KJS: saw %d digit \\u sequence.\n", j);
- i -= j;
- break;
- }
- }
- if (j < 4) {
- // sequence was incomplete. treat \u as u which IE always
- // and FF sometimes does.
- intern.append(UString('u'));
- } else {
+ // standard unicode escape sequence looks like \uxxxx but
+ // other browsers also accept less then 4 hex digits
+ unsigned short u = 0;
+ int j = 0;
+ for (j = 0; j < 4; ++j) {
+ if (i + 1 < p.size() && Lexer::isHexDigit(p[i + 1].unicode())) {
+ u = (u << 4) + Lexer::convertHex(p[i + 1].unicode());
+ ++i;
+ } else {
+ // sequence incomplete. restore index.
+ // TODO: cleaner way to propagate warning
+ fprintf(stderr, "KJS: saw %d digit \\u sequence.\n", j);
+ i -= j;
+ break;
+ }
+ }
+ if (j < 4) {
+ // sequence was incomplete. treat \u as u which IE always
+ // and FF sometimes does.
+ intern.append(UString('u'));
+ } else {
c = UChar(u);
switch (u) {
case 0:
- // Make sure to encode 0, to avoid terminating the string
- intern += UString(nil);
- break;
+ // Make sure to encode 0, to avoid terminating the string
+ intern += UString(nil);
+ break;
case '^':
case '$':
case '\\':
@@ -102,13 +101,13 @@ RegExp::RegExp(const UString &p, int f)
case '{': case '}':
case '[': case ']':
case '|':
- // escape pattern characters have to remain escaped
- intern.append(UString('\\'));
- // intentional fallthrough
+ // escape pattern characters have to remain escaped
+ intern.append(UString('\\'));
+ // intentional fallthrough
default:
- intern += UString(&c, 1);
- break;
- }
+ intern += UString(&c, 1);
+ break;
+ }
}
continue;
}
@@ -127,45 +126,47 @@ RegExp::RegExp(const UString &p, int f)
intern = p;
}
-#ifdef HAVE_PCREPOSIX
- int pcreflags = 0;
- const char *perrormsg;
- int errorOffset;
+#ifdef HAVE_PCRE2POSIX
+ uint32_t pcre2flags = 0;
+ int errorCode;
+ PCRE2_SIZE errorOffset;
if (flgs & IgnoreCase)
- pcreflags |= PCRE_CASELESS;
+ pcre2flags |= PCRE2_CASELESS;
if (flgs & Multiline)
- pcreflags |= PCRE_MULTILINE;
+ pcre2flags |= PCRE2_MULTILINE;
-#ifdef PCRE_CONFIG_UTF8
if (utf8Support == Supported)
- pcreflags |= (PCRE_UTF8 | PCRE_NO_UTF8_CHECK);
-#endif
+ pcre2flags |= (PCRE2_UTF | PCRE2_NO_UTF_CHECK);
// Fill our buffer with an encoded version, whether utf-8, or,
// if PCRE is incapable, truncated.
prepareMatch(intern);
- pcregex = pcre_compile(buffer, pcreflags,
- &perrormsg, &errorOffset, NULL);
+ pcregex = pcre2_compile(buffer, PCRE2_ZERO_TERMINATED, pcre2flags,
+ &errorCode, &errorOffset, NULL);
doneMatch(); // Cleanup buffers
if (!pcregex) {
#ifndef NDEBUG
- fprintf(stderr, "KJS: pcre_compile() failed with '%s'\n", perrormsg);
+ PCRE2_UCHAR errorMsg[256];
+ pcre2_get_error_message(errorCode, errorMsg, sizeof(errorMsg));
+ fprintf(stderr, "KJS: pcre_compile() failed with '%s'\n", errorMsg);
#endif
+ match_data = nullptr;
valid = false;
return;
}
-#ifdef PCRE_INFO_CAPTURECOUNT
// Get number of subpatterns that will be returned
- int rc = pcre_fullinfo( pcregex, NULL, PCRE_INFO_CAPTURECOUNT, &nrSubPatterns);
+ int rc = pcre2_pattern_info(pcregex, PCRE2_INFO_CAPTURECOUNT, &nrSubPatterns);
if (rc != 0)
-#endif
+ {
nrSubPatterns = 0; // fallback. We always need the first pair of offsets.
+ }
-#else /* HAVE_PCREPOSIX */
+ match_data = pcre2_match_data_create_from_pattern(pcregex, NULL);
+#else
int regflags = 0;
#ifdef REG_EXTENDED
@@ -196,9 +197,15 @@ RegExp::RegExp(const UString &p, int f)
RegExp::~RegExp()
{
doneMatch(); // Be 100% sure buffers are freed
-#ifdef HAVE_PCREPOSIX
+#ifdef HAVE_PCRE2POSIX
+ if (match_data)
+ {
+ pcre2_match_data_free(match_data);
+ }
if (pcregex)
- pcre_free(pcregex);
+ {
+ pcre2_code_free(pcregex);
+ }
#else
/* TODO: is this really okay after an error ? */
regfree(&preg);
@@ -209,7 +216,7 @@ void RegExp::prepareUtf8(const UString& s)
{
// Allocate a buffer big enough to hold all the characters plus \0
const int length = s.size();
- buffer = new char[length * 3 + 1];
+ buffer = new buftype_t[length * 3 + 1];
// Also create buffer for positions. We need one extra character in there,
// even past the \0 since the non-empty handling may jump one past the end
@@ -218,7 +225,7 @@ void RegExp::prepareUtf8(const UString& s)
// Convert to runs of 8-bit characters, and generate indeces
// Note that we do NOT combine surrogate pairs here, as
// regexps operate on them as separate characters
- char *p = buffer;
+ buftype_t *p = buffer;
int *posOut = originalPos;
const UChar *d = s.data();
for (int i = 0; i != length; ++i) {
@@ -226,16 +233,16 @@ void RegExp::prepareUtf8(const UString& s)
int sequenceLen;
if (c < 0x80) {
- *p++ = (char)c;
+ *p++ = (buftype_t)c;
sequenceLen = 1;
} else if (c < 0x800) {
- *p++ = (char)((c >> 6) | 0xC0); // C0 is the 2-byte flag for UTF-8
- *p++ = (char)((c | 0x80) & 0xBF); // next 6 bits, with high bit set
+ *p++ = (buftype_t)((c >> 6) | 0xC0); // C0 is the 2-byte flag for UTF-8
+ *p++ = (buftype_t)((c | 0x80) & 0xBF); // next 6 bits, with high bit set
sequenceLen = 2;
} else {
- *p++ = (char)((c >> 12) | 0xE0); // E0 is the 3-byte flag for UTF-8
- *p++ = (char)(((c >> 6) | 0x80) & 0xBF); // next 6 bits, with high bit set
- *p++ = (char)((c | 0x80) & 0xBF); // next 6 bits, with high bit set
+ *p++ = (buftype_t)((c >> 12) | 0xE0); // E0 is the 3-byte flag for UTF-8
+ *p++ = (buftype_t)(((c >> 6) | 0x80) & 0xBF); // next 6 bits, with high bit set
+ *p++ = (buftype_t)((c | 0x80) & 0xBF); // next 6 bits, with high bit set
sequenceLen = 3;
}
@@ -263,7 +270,7 @@ void RegExp::prepareASCII (const UString& s)
// when we don't have utf 8 available -- use
// truncated version, and pray for the best
CString truncated = s.cstring();
- buffer = new char[truncated.size() + 1];
+ buffer = new buftype_t[truncated.size() + 1];
memcpy(buffer, truncated.c_str(), truncated.size());
buffer[truncated.size()] = '\0'; // For _compile use
bufferSize = truncated.size();
@@ -273,7 +280,7 @@ void RegExp::prepareMatch(const UString &s)
{
delete[] originalPos; // Just to be sure..
delete[] buffer;
-#ifdef PCRE_CONFIG_UTF8
+#ifdef HAVE_PCRE2POSIX
if (utf8Support == Supported)
prepareUtf8(s);
else
@@ -309,17 +316,16 @@ UString RegExp::match(const UString &s, int i, int *pos, int **ovector)
if (i > s.size() || s.isNull())
return UString::null;
-#ifdef HAVE_PCREPOSIX
- int ovecsize = (nrSubPatterns+1)*3; // see pcre docu
- if (ovector) *ovector = new int[ovecsize];
- if (!pcregex)
+#ifdef HAVE_PCRE2POSIX
+ if (!pcregex || !match_data)
+ return UString::null;
+ if (!ovector)
return UString::null;
int startPos;
int nextPos;
-
-#ifdef PCRE_CONFIG_UTF8
- if (utf8Support == Supported) {
+ if (utf8Support == Supported)
+ {
startPos = i;
while (originalPos[startPos] < i)
++startPos;
@@ -329,53 +335,59 @@ UString RegExp::match(const UString &s, int i, int *pos, int **ovector)
while (originalPos[nextPos] < (i + 1))
++nextPos;
}
- } else
-#endif
+ }
+ else
{
startPos = i;
nextPos = i + (i < s.size() ? 1 : 0);
}
- int baseFlags =
-#ifdef PCRE_CONFIG_UTF8
- utf8Support == Supported ? PCRE_NO_UTF8_CHECK :
-#endif
- 0;
- int numMatches = pcre_exec(pcregex, NULL, buffer, bufferSize, startPos,
- m_notEmpty ? (PCRE_NOTEMPTY | PCRE_ANCHORED | baseFlags) : baseFlags, // see man pcretest
- ovector ? *ovector : 0L, ovecsize);
- if (numMatches < 0)
+ uint32_t baseFlags = (utf8Support == Supported ? PCRE2_NO_UTF_CHECK : 0);
+ if (m_notEmpty)
+ {
+ baseFlags |= PCRE2_NOTEMPTY | PCRE2_ANCHORED;
+ }
+ int numMatches = pcre2_match(pcregex, buffer, PCRE2_ZERO_TERMINATED, startPos, baseFlags, match_data, NULL);
+ if (numMatches <= 0)
{
// Failed to match.
- if (numMatches == PCRE_ERROR_NOMATCH && (flgs & Global) && m_notEmpty && ovector && startPos < nextPos)
+ if (numMatches == PCRE2_ERROR_NOMATCH && (flgs & Global) && m_notEmpty && startPos < nextPos)
{
// We set m_notEmpty ourselves, to look for a non-empty match
- // (see man pcretest or pcretest.c for details).
// So we don't stop here, we want to try again at i+1.
#ifdef KJS_VERBOSE
fprintf(stderr, "No match after m_notEmpty. +1 and keep going.\n");
#endif
m_notEmpty = 0;
- numMatches = pcre_exec(pcregex, NULL, buffer, bufferSize, nextPos, baseFlags,
- ovector ? *ovector : 0L, ovecsize);
- if (numMatches < 0)
+ baseFlags = (utf8Support == Supported ? PCRE2_NO_UTF_CHECK : 0);
+ numMatches = pcre2_match(pcregex, buffer, PCRE2_ZERO_TERMINATED, nextPos, baseFlags, match_data, NULL);
+ if (numMatches <= 0)
return UString::null;
}
- else // done
+ else
return UString::null;
}
- // Got a match, proceed with it.
- // But fix up the ovector if need be..
- if (ovector && originalPos) {
- for (unsigned c = 0; c < 2 * TQMIN((unsigned)numMatches, nrSubPatterns+1); ++c) {
- if ((*ovector)[c] != -1)
- (*ovector)[c] = originalPos[(*ovector)[c]];
+ PCRE2_SIZE *pcre2_ovector = pcre2_get_ovector_pointer(match_data);
+ if (!pcre2_ovector)
+ return UString::null;
+
+ uint32_t pcre2_ovecCount = pcre2_get_ovector_count(match_data);
+ *ovector = new int[pcre2_ovecCount * 2];
+ if (originalPos)
+ {
+ for (size_t c = 0; c < 2 * pcre2_ovecCount; ++c)
+ {
+ (*ovector)[c] = (pcre2_ovector[c] != -1) ? originalPos[pcre2_ovector[c]] : -1;
+ }
+ }
+ else
+ {
+ for (size_t c = 0; c < 2 * pcre2_ovecCount; ++c)
+ {
+ (*ovector)[c] = pcre2_ovector[c];
}
}
-
- if (!ovector)
- return UString::null; // don't rely on the return value if you pass ovector==0
#else
const uint maxMatch = 10;
regmatch_t rmatch[maxMatch];
@@ -420,28 +432,3 @@ UString RegExp::match(const UString &s, int i, int *pos, int **ovector)
}
return s.substr((*ovector)[0], (*ovector)[1] - (*ovector)[0]);
}
-
-#if 0 // unused
-bool RegExp::test(const UString &s, int)
-{
-#ifdef HAVE_PCREPOSIX
- int ovector[300];
- CString buffer(s.cstring());
-
- if (s.isNull() ||
- pcre_exec(pcregex, NULL, buffer.c_str(), buffer.size(), 0,
- 0, ovector, 300) == PCRE_ERROR_NOMATCH)
- return false;
- else
- return true;
-
-#else
-
- char *str = strdup(s.ascii());
- int r = regexec(&preg, str, 0, 0, 0);
- free(str);
-
- return r == 0;
-#endif
-}
-#endif
diff --git a/kjs/regexp.h b/kjs/regexp.h
index 3a14728d0..d84fca17c 100644
--- a/kjs/regexp.h
+++ b/kjs/regexp.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
@@ -22,17 +21,21 @@
#ifndef _KJS_REGEXP_H_
#define _KJS_REGEXP_H_
+#include <stdint.h>
#include <sys/types.h>
#include "config.h"
-#ifdef HAVE_PCREPOSIX
-#include <pcre.h>
+#ifdef HAVE_PCRE2POSIX
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
+typedef PCRE2_UCHAR8 buftype_t;
#else // POSIX regex - not so good...
extern "C" { // bug with some libc5 distributions
#include <regex.h>
+typedef char buftype_t;
}
-#endif //HAVE_PCREPOSIX
+#endif
#include "ustring.h"
@@ -62,7 +65,7 @@ namespace KJS {
bool valid;
// Cached encoding info...
- char* buffer;
+ buftype_t *buffer;
int* originalPos;
int bufferSize;
@@ -72,22 +75,20 @@ namespace KJS {
UString originalS; // the original string, used for sanity-checking
#endif
-#ifndef HAVE_PCREPOSIX
+#ifndef HAVE_PCRE2POSIX
regex_t preg;
#else
- pcre *pcregex;
+ pcre2_code *pcregex;
+ pcre2_match_data *match_data;
enum UTF8SupportState {
Unknown,
Supported,
Unsupported
};
-
-#ifdef PCRE_CONFIG_UTF8
static UTF8SupportState utf8Support;
#endif
-#endif
- unsigned int nrSubPatterns;
+ uint32_t nrSubPatterns;
RegExp();
};
diff --git a/kjs/regexp_object.cpp b/kjs/regexp_object.cpp
index edd2bbeca..976a36890 100644
--- a/kjs/regexp_object.cpp
+++ b/kjs/regexp_object.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/regexp_object.h b/kjs/regexp_object.h
index 9f24ce7c9..643b04eeb 100644
--- a/kjs/regexp_object.h
+++ b/kjs/regexp_object.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/simple_number.h b/kjs/simple_number.h
index 1f5830dff..e3230e9f9 100644
--- a/kjs/simple_number.h
+++ b/kjs/simple_number.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2003 Apple Computer, Inc
diff --git a/kjs/string_object.cpp b/kjs/string_object.cpp
index b56620a8c..304a4ba34 100644
--- a/kjs/string_object.cpp
+++ b/kjs/string_object.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
@@ -38,9 +37,6 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef HAVE_SYS_BITYPES_H
-#include <sys/bitypes.h> /* For uintXX_t on Tru64 */
-#endif
using namespace KJS;
@@ -571,7 +567,9 @@ Value StringProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &arg
result = String(s);
break;
case LocaleCompare:
+ {
return Number(localeCompare(s, a0.toString(exec)));
+ }
#ifndef KJS_PURE_ECMA
case Big:
result = String("<big>" + s + "</big>");
diff --git a/kjs/string_object.h b/kjs/string_object.h
index d1c87ddf4..8f51a376a 100644
--- a/kjs/string_object.h
+++ b/kjs/string_object.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/testkjs.cpp b/kjs/testkjs.cpp
index fcea6687f..5d9db6464 100644
--- a/kjs/testkjs.cpp
+++ b/kjs/testkjs.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/types.h b/kjs/types.h
index 603b2a26e..06f3d9e59 100644
--- a/kjs/types.h
+++ b/kjs/types.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
diff --git a/kjs/ustring.cpp b/kjs/ustring.cpp
index 36f201863..dfe78f263 100644
--- a/kjs/ustring.cpp
+++ b/kjs/ustring.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/ustring.h b/kjs/ustring.h
index 0cdfa3f0f..a5fc55897 100644
--- a/kjs/ustring.h
+++ b/kjs/ustring.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
diff --git a/kjs/value.cpp b/kjs/value.cpp
index e95756c48..d5a7a9731 100644
--- a/kjs/value.cpp
+++ b/kjs/value.cpp
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
@@ -362,11 +361,12 @@ Number::Number(int i)
Number::Number(unsigned int u)
: Value(SimpleNumber::fits(u) ? SimpleNumber::make(u) : new NumberImp(static_cast<double>(u))) { }
-Number::Number(double d)
+// check for NaN first if we werent't compiled with -mieee on Alpha
#if defined(__alpha) && !defined(_IEEE_FP)
- // check for NaN first if we werent't compiled with -mieee on Alpha
+Number::Number(double d)
: Value(KJS::isNaN(d) ? NumberImp::staticNaN : (SimpleNumber::fits(d) ? SimpleNumber::make((long)d) : new NumberImp(d))) { }
#else
+Number::Number(double d)
: Value(SimpleNumber::fits(d) ? SimpleNumber::make((long)d) : (KJS::isNaN(d) ? NumberImp::staticNaN : new NumberImp(d))) { }
#endif
diff --git a/kjs/value.h b/kjs/value.h
index 7c2e4b111..a54aa9240 100644
--- a/kjs/value.h
+++ b/kjs/value.h
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)