source: webkit/trunk/JavaScriptCore/kjs/regexp.h@ 11213

Last change on this file since 11213 was 10456, checked in by darin, 20 years ago

Reviewed, tweaked and landed by Darin.

  • some Windows compilation fixes, hoping to fix the problems reported in these bugs: 4627, 4629, 4630, 4631, 4632, 4633, 4634, 4635, 4636, 4637, 4639, 4640, 4641, 4644, 4645
  • kjs/collector.cpp: Include <windows.h> on WIN32. Put thread-related code inside KJS_MULTIPLE_THREADS #if directives. (KJS::Collector::markCurrentThreadConservatively): Use NT_TIB to find the stack base on Win32.
  • kjs/config.h: Define HAVE_SYS_TIMEB_H for Win32.
  • kjs/date_object.cpp: Add include of <limits.h>. Add definitions of strncasecmp, isfinite, and copysign for Win32. (KJS::KRFCDate_parseDate): Move "errno = 0" line down closer to the first call to strol -- I believe that on Win32 there's some other call before that setting errno.
  • kjs/date_object.h: Remove unneeded include of <sys/time.h>.
  • kjs/dtoa.cpp: Add an undef of strtod, needed on Win32.
  • kjs/fast_malloc.cpp: Put #if !WIN32 around some customization that's not appropriate on Win32. (KJS::region_list_append): Add a missing cast so this Win32-specific function compiles in C++. (KJS::sbrk): Change parameter type to match the declaration.
  • kjs/function.cpp: (isxdigit): Define a locale-independent isxdigit on Win32.
  • kjs/function.h: Remove unneeded friend class Function for FunctionImp.
  • kjs/identifier.cpp: Took out the APPLE_CHANGES from around the AVOID_STATIC_CONSTRUCTORS define. We ultimately intend to phase out APPLE_CHANGES entirely. Also fix the non-AVOID_STATIC_CONSTRUCTORS code path.
  • kjs/internal.cpp: Remove uneeded include of <strings.h>, which was confused with <string.h>! Add a Win32 implementation of copysign. Put the threads code inside KJS_MULTIPLE_THREADS.
  • kjs/internal.h: Define a KJS_MULTIPLE_THREADS macro on non-Win32 only. Later we can make this specific to Mac OS X if we like.
  • kjs/interpreter_map.cpp: Add missing include of <stdlib.h>.
  • kjs/list.cpp: (KJS::ListImp::markValues): Use std::min instead of MIN. (KJS::List::copy): Ditto. (KJS::List::copyTail): Ditto.
  • kjs/math_object.cpp: (signbit): Add a Win32 implementation of signbit.
  • kjs/nodes.cpp: (Node::finalCheck): Use unsigned instead of uint. Put the use of always_inline inside GNUC.
  • kjs/number_object.cpp: (NumberProtoFuncImp::callAsFunction): Use "10.0" instead of "10" inside all the calls to pow to avoid ambiguity caused by overloading of pow on Win32, seen when passing an int rather than a double or float.
  • kjs/operations.cpp: (KJS::isInf): Add Win32 implementation. (KJS::isPosInf): Add Win32 implementation. (KJS::isNegInf): Add Win32 implementation.
  • kjs/regexp.cpp: Use unsigned instead of uint.
  • kjs/regexp.h: Ditto.
  • kjs/regexp_object.cpp: Ditto.
  • kjs/regexp_object.h: Ditto.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 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 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22#ifndef _KJS_REGEXP_H_
23#define _KJS_REGEXP_H_
24
25#include <sys/types.h>
26
27#include "config.h"
28
29#ifdef HAVE_PCREPOSIX
30#include <pcre.h>
31#else // POSIX regex - not so good...
32extern "C" { // bug with some libc5 distributions
33#include <regex.h>
34}
35#endif //HAVE_PCREPOSIX
36
37#include "ustring.h"
38
39namespace KJS {
40
41 class RegExp {
42 public:
43 enum { None = 0, Global = 1, IgnoreCase = 2, Multiline = 4 };
44
45 RegExp(const UString &pattern, int flags = None);
46 ~RegExp();
47
48 int flags() const { return _flags; }
49
50 UString match(const UString &s, int i, int *pos = 0, int **ovector = 0);
51 unsigned subPatterns() const { return _numSubPatterns; }
52
53 private:
54#ifdef HAVE_PCREPOSIX
55 pcre *_regex;
56#else
57 regex_t _regex;
58#endif
59 int _flags;
60 unsigned _numSubPatterns;
61
62 RegExp(const RegExp &);
63 RegExp &operator=(const RegExp &);
64 };
65
66} // namespace
67
68#endif
Note: See TracBrowser for help on using the repository browser.