Changeset 13089 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Mar 2, 2006, 1:12:06 AM (19 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Darin.


  • Set up new prototype macros and avoid using #if without defined() in JSC


Added new PLATFORM macros and related, to make sure #if's all check if relevant macros
are defined, and to separate core OS-level dependencies from operating environment
dependencies so you can, e.g., build KDE on Mac or Windows.

  • kxmlcore/Platform.h: Added.


  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bindings/jni/jni_utility.cpp: (KJS::Bindings::convertValueToJValue):
  • bindings/objc/WebScriptObject.mm:
  • bindings/objc/objc_instance.mm: (ObjcInstance::end):
  • bindings/softlinking.h:
  • bindings/testbindings.mm: (main):
  • kjs/JSLock.cpp:
  • kjs/collector.cpp: (KJS::Collector::markCurrentThreadConservatively): (KJS::Collector::markOtherThreadConservatively): (KJS::Collector::markStackObjectsConservatively):
  • kjs/config.h:
  • kjs/date_object.cpp: (gmtoffset): (KJS::formatTime): (KJS::DateProtoFunc::callAsFunction): (KJS::DateObjectImp::construct): (KJS::makeTime):
  • kjs/dtoa.cpp:
  • kjs/fpconst.cpp: (KJS::sizeof): (KJS::):
  • kjs/grammar.y:
  • kjs/identifier.cpp:
  • kjs/internal.cpp:
  • kjs/interpreter.cpp: (KJS::Interpreter::evaluate): (KJS::Interpreter::createLanguageInstanceForValue):
  • kjs/interpreter.h:
  • kjs/lookup.cpp:
  • kjs/lookup.h:
  • kjs/math_object.cpp:
  • kjs/object.cpp:
  • kjs/object.h:
  • kjs/operations.cpp: (KJS::isNaN): (KJS::isInf): (KJS::isPosInf): (KJS::isNegInf):
  • kjs/operations.h:
  • kjs/regexp.cpp: (KJS::RegExp::RegExp): (KJS::RegExp::~RegExp): (KJS::RegExp::match):
  • kjs/regexp.h:
  • kjs/testkjs.cpp: (StopWatch::start): (StopWatch::stop): (StopWatch::getElapsedMS):
  • kjs/ustring.cpp:
  • kjs/ustring.h:
  • kxmlcore/AlwaysInline.h:
  • kxmlcore/Assertions.cpp:
  • kxmlcore/Assertions.h:
  • kxmlcore/FastMalloc.cpp: (KXMLCore::):
  • kxmlcore/FastMalloc.h:
  • kxmlcore/FastMallocInternal.h:
  • kxmlcore/HashTable.h:
  • kxmlcore/TCPageMap.h:
  • kxmlcore/TCSpinLock.h: (TCMalloc_SpinLock::Lock): (TCMalloc_SpinLock::Unlock): (TCMalloc_SlowLock):
  • kxmlcore/TCSystemAlloc.cpp: (TCMalloc_SystemAlloc):
  • os-win32/stdint.h:

JavaScriptGlue:

Not reviewed, but I noticed these trivial extra changes were needed to avoid
breaking the build with my reviewed patch for:


http://bugzilla.opendarwin.org/show_bug.cgi?id=7387


Add config.h, includes of it, and Platform.h forwarding header.

  • JSBase.cpp:
  • JSObject.cpp:
  • JSRun.cpp:
  • JSUtils.cpp:
  • JSValueWrapper.cpp:
  • JavaScriptGlue.cpp:
  • UserObjectImp.cpp:
  • config.h: Added.
  • kxmlcore/Platform.h: Added.

WebCore:

Reviewed by Darin.


Add Platform.h

  • ForwardingHeaders/kxmlcore/Platform.h: Added.
  • bridge/mac/WebCoreFrameNamespaces.m:
  • bridge/mac/WebCoreViewFactory.m:
  • bridge/mac/WebDashboardRegion.m:
  • config.h:
  • platform/Logging.cpp:
  • platform/mac/ScrollViewMac.mm: (WebCore::ScrollView::addChild):
  • platform/mac/WebCoreCookieAdapter.m:
  • platform/mac/WebCoreGraphicsBridge.m:
  • platform/mac/WebCoreHistory.m:
  • platform/mac/WebCoreImageRendererFactory.m:
  • platform/mac/WebCoreKeyGenerator.m:
  • platform/mac/WebCoreView.m:
Location:
trunk/JavaScriptCore/kjs
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSLock.cpp

    r12728 r13089  
    2828namespace KJS {
    2929
    30 #if KJS_MULTIPLE_THREADS
     30#if USE(MULTIPLE_THREADS)
    3131
    3232static pthread_once_t interpreterLockOnce = PTHREAD_ONCE_INIT;
  • trunk/JavaScriptCore/kjs/collector.cpp

    r12897 r13089  
    3333#include <algorithm>
    3434
    35 #if __APPLE__
     35#if PLATFORM(DARWIN)
    3636
    3737#include <pthread.h>
     
    4040#include <mach/thread_act.h>
    4141
    42 #elif WIN32
     42#elif PLATFORM(WIN_OS)
    4343
    4444#include <windows.h>
    4545
    46 #else
     46#elif PLATFORM(UNIX)
    4747
    4848#include <pthread.h>
    4949
    50 #ifdef HAVE_PTHREAD_NP_H
    51 
     50#if HAVE(PTHREAD_NP_H)
    5251#include <pthread_np.h>
    53 
    54 #endif
    55 
    56 #endif
     52#endif
     53
     54#endif
     55
     56#define DEBUG_COLLECTOR 0
    5757
    5858using std::max;
     
    192192}
    193193
    194 #if KJS_MULTIPLE_THREADS
     194#if USE(MULTIPLE_THREADS)
    195195
    196196struct Collector::Thread {
     
    301301    setjmp(registers);
    302302
    303 #if __APPLE__
     303#if PLATFORM(DARWIN)
    304304    pthread_t thread = pthread_self();
    305305    void *stackBase = pthread_get_stackaddr_np(thread);
    306 #elif WIN32
     306#elif PLATFORM(WIN_OS) && PLATFORM(X86) && COMPILER(MSVC)
    307307    NT_TIB *pTib;
    308308    __asm {
     
    311311    }
    312312    void *stackBase = (void *)pTib->StackBase;
    313 #else
     313#elif PLATFORM(UNIX)
    314314    static void *stackBase = 0;
    315315    static pthread_t stackThread;
     
    317317    if (stackBase == 0 || thread != stackThread) {
    318318        pthread_attr_t sattr;
    319 #ifdef HAVE_PTHREAD_NP_H
     319#if HAVE(PTHREAD_NP_H)
    320320        // e.g. on FreeBSD 5.4, [email protected]
    321321        pthread_attr_get_np(thread, &sattr);
     
    330330        stackThread = thread;
    331331    }
     332#else
     333#error Need a way to get the stack base on this platform
    332334#endif
    333335
     
    338340}
    339341
    340 #if KJS_MULTIPLE_THREADS
     342#if USE(MULTIPLE_THREADS)
    341343
    342344typedef unsigned long usword_t; // word size, assumed to be either 32 or 64 bit
     
    346348  thread_suspend(thread->machThread);
    347349
    348 #if KJS_CPU_X86
     350#if PLATFORM(X86)
    349351  i386_thread_state_t regs;
    350352  unsigned user_count = sizeof(regs)/sizeof(int);
    351353  thread_state_flavor_t flavor = i386_THREAD_STATE;
    352 #elif KJS_CPU_PPC
     354#elif PLATFORM(PPC)
    353355  ppc_thread_state_t  regs;
    354356  unsigned user_count = PPC_THREAD_STATE_COUNT;
    355357  thread_state_flavor_t flavor = PPC_THREAD_STATE;
    356 #elif KJS_CPU_PPC64
     358#elif PLATFORM(PPC64)
    357359  ppc_thread_state64_t  regs;
    358360  unsigned user_count = PPC_THREAD_STATE64_COUNT;
     
    368370 
    369371  // scan the stack
    370 #if KJS_CPU_X86
     372#if PLATFORM(X86)
    371373  markStackObjectsConservatively((void *)regs.esp, pthread_get_stackaddr_np(thread->posixThread));
    372 #elif KJS_CPU_PPC || KJS_CPU_PPC64
     374#elif PLATFORM(PPC) || PLATFORM(PPC64)
    373375  markStackObjectsConservatively((void *)regs.r1, pthread_get_stackaddr_np(thread->posixThread));
    374376#else
     
    385387  markCurrentThreadConservatively();
    386388
    387 #if KJS_MULTIPLE_THREADS
     389#if USE(MULTIPLE_THREADS)
    388390  for (Thread *thread = registeredThreads; thread != NULL; thread = thread->next) {
    389391    if (thread->posixThread != pthread_self()) {
  • trunk/JavaScriptCore/kjs/config.h

    r12305 r13089  
    1 #if __APPLE__
     1#include <kxmlcore/Platform.h>
     2
     3#if PLATFORM(DARWIN)
    24
    35#define HAVE_ERRNO_H 1
     
    1113#define HAVE_SYS_TIMEB_H 1
    1214
    13 #define KJS_MULTIPLE_THREADS 1
    14 
    15 #elif WIN32
     15#elif PLATFORM(WIN_OS)
    1616
    1717#define HAVE_FLOAT_H 1
    1818#define HAVE_FUNC__FINITE 1
    1919#define HAVE_SYS_TIMEB_H 1
     20
     21
    2022#define USE_SYSTEM_MALLOC 1
    2123
    2224#else
     25
     26// FIXME: is this actually used or do other platforms generate their
     27// own config.h?
    2328
    2429#define HAVE_ERRNO_H 1
     
    3338#endif
    3439
    35 #define HAVE_FUNC_STRTOLL 1
    3640#define HAVE_ICU 1
    3741#define HAVE_PCREPOSIX 1
     42
     43// FIXME: if all platforms have these, do they really need #defines?
    3844#define HAVE_STDINT_H 1
    3945#define HAVE_STRING_H 1
    40 
    41 #if __ppc__ || __PPC__ || __powerpc__
    42 #define KJS_CPU_PPC 1
    43 #define WORDS_BIGENDIAN 1
    44 #elif __ppc64__ || __PPC64__
    45 #define KJS_CPU_PPC64 1
    46 #define WORDS_BIGENDIAN 1
    47 #elif __i386__
    48 #define KJS_CPU_X86 1
    49 #endif
    5046
    5147#define KXC_CHANGES 1
  • trunk/JavaScriptCore/kjs/date_object.cpp

    r13015 r13089  
    2323#include "date_object.h"
    2424
    25 #if HAVE_ERRNO_H
     25#if HAVE(ERRNO_H)
    2626#include <errno.h>
    2727#endif
    2828
    29 #if HAVE_SYS_PARAM_H
     29#if HAVE(SYS_PARAM_H)
    3030#include <sys/param.h>
    3131#endif
    3232
    33 #if HAVE_SYS_TIME_H
     33#if HAVE(SYS_TIME_H)
    3434#include <sys/time.h>
    3535#endif
    3636
    37 #if HAVE_SYS_TIMEB_H
     37#if HAVE(SYS_TIMEB_H)
    3838#include <sys/timeb.h>
    3939#endif
     
    5252#include "operations.h"
    5353
    54 #if __APPLE__
     54#if PLATFORM(MAC)
    5555#include <CoreFoundation/CoreFoundation.h>
    5656#endif
    5757
    58 #if WIN32
     58#if PLATFORM(WIN_OS)
    5959#define copysign(x, y) _copysign(x, y)
    6060#define isfinite(x) _finite(x)
     
    6565inline int gmtoffset(const tm& t)
    6666{
    67 #if WIN32
     67#if PLATFORM(WIN_OS)
    6868    // Time is supposed to be in the current timezone.
    6969    // FIXME: Use undocumented _dstbias?
     
    142142static void millisecondsToTM(double milli, bool utc, tm *t);
    143143
    144 #if __APPLE__
     144#if PLATFORM(MAC)
    145145
    146146static CFDateFormatterStyle styleFromArgString(const UString& string, CFDateFormatterStyle defaultStyle)
     
    207207}
    208208
    209 #endif // __APPLE__
     209#endif // PLATFORM(MAC)
    210210
    211211static UString formatDate(const tm &t)
     
    231231    char buffer[100];
    232232    if (utc) {
    233 #if !WIN32
     233        // FIXME: why not on windows?
     234#if !PLATFORM(WIN_OS)
    234235        ASSERT(t.tm_gmtoff == 0);
    235236#endif
     
    554555  JSValue *result = 0;
    555556  UString s;
    556 #if !__APPLE__
     557#if !PLATFORM(DARWIN)
    557558  const int bufsize=100;
    558559  char timebuffer[bufsize];
     
    610611    return jsString(formatDateUTCVariant(t) + " " + formatTime(t, utc));
    611612    break;
    612 #if __APPLE__
     613#if PLATFORM(MAC)
    613614  case ToLocaleString:
    614615    return jsString(formatLocaleDate(exec, secs, true, true, args));
     
    735736
    736737  if (numArgs == 0) { // new Date() ECMA 15.9.3.3
    737 #if !WIN32
     738#if PLATFORM(WIN_OS)
     739#if COMPILER(BORLAND)
     740    struct timeb timebuffer;
     741    ftime(&timebuffer);
     742#else
     743    struct _timeb timebuffer;
     744    _ftime(&timebuffer);
     745#endif
     746    double utc = timebuffer.time * msPerSecond + timebuffer.millitm;
     747#else
    738748    struct timeval tv;
    739749    gettimeofday(&tv, 0);
    740750    double utc = floor(tv.tv_sec * msPerSecond + tv.tv_usec / 1000);
    741 #else
    742 #  if __BORLANDC__
    743     struct timeb timebuffer;
    744     ftime(&timebuffer);
    745 #  else
    746     struct _timeb timebuffer;
    747     _ftime(&timebuffer);
    748 #  endif
    749     double utc = timebuffer.time * msPerSecond + timebuffer.millitm;
    750751#endif
    751752    value = utc;
     
    855856// obsolete time zones not listed here equivalent to "-0000".
    856857static const struct KnownZone {
    857 #if !WIN32
     858#if !PLATFORM(WIN_OS)
    858859    const
    859860#endif
     
    878879    if (utc) {
    879880        time_t zero = 0;
    880 #if !WIN32
     881#if PLATFORM(WIN_OS)
     882        // FIXME: not thread safe
     883        (void)localtime(&zero);
     884#if COMPILER(BORLAND) || COMPILER(CYGWIN)
     885        utcOffset = - _timezone;
     886#else
     887        utcOffset = - timezone;
     888#endif
     889        t->tm_isdst = 0;
     890#else
    881891        tm t3;
    882892        localtime_r(&zero, &t3);
    883893        utcOffset = t3.tm_gmtoff;
    884894        t->tm_isdst = t3.tm_isdst;
    885 #else
    886         // FIXME: not thread safe
    887         (void)localtime(&zero);
    888 #  if __BORLANDC__ || __CYGWIN__
    889         utcOffset = - _timezone;
    890 #  else
    891         utcOffset = - timezone;
    892 #  endif
    893         t->tm_isdst = 0;
    894895#endif
    895896    } else {
  • trunk/JavaScriptCore/kjs/dtoa.cpp

    r12069 r13089  
    173173#include "dtoa.h"
    174174
    175 #ifdef WORDS_BIGENDIAN
     175#if PLATFORM(BIG_ENDIAN)
    176176#define IEEE_MC68k
    177177#else
  • trunk/JavaScriptCore/kjs/fpconst.cpp

    r12315 r13089  
    3232// It would be good to figure out a 100% clean way that still avoids code that runs at init time.
    3333
    34 #if __APPLE__
     34#if PLATFORM(DARWIN)
    3535
    36 #ifdef WORDS_BIGENDIAN
    37   extern const unsigned char NaN[sizeof(double)] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 };
    38   extern const unsigned char Inf[sizeof(double)] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 };
     36#if PLATFORM(BIG_ENDIAN)
     37    extern const unsigned char NaN[sizeof(double)] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 };
     38    extern const unsigned char Inf[sizeof(double)] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 };
     39#elif PLATFORM(MIDDLE_ENDIAN)
     40    extern const unsigned char NaN[] = { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 };
     41    extern const unsigned char Inf[] = { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 };
    3942#else
    40   extern const unsigned char NaN[sizeof(double)] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f };
    41   extern const unsigned char Inf[sizeof(double)] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f };
     43    extern const unsigned char NaN[sizeof(double)] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f };
     44    extern const unsigned char Inf[sizeof(double)] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f };
     45#endif // PLATFORM(MIDDLE_ENDIAN)
     46
     47#else // !PLATFORM(DARWIN)
     48
     49#include "value.h"
     50
     51#if PLATFORM(BIG_ENDIAN)
     52    const unsigned char NaN_Bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 };
     53    const unsigned char Inf_Bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 };
     54#elif PLATFORM(MIDDLE_ENDIAN)
     55    const unsigned char NaN_Bytes[] = { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 };
     56    const unsigned char Inf_Bytes[] = { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 };
     57#else
     58    const unsigned char NaN_Bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f };
     59    const unsigned char Inf_Bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f };
    4260#endif
     61    const double NaN = *(const double*) NaN_Bytes;
     62    const double Inf = *(const double*) Inf_Bytes;
     63 
     64#endif // !PLATFORM(DARWIN)
    4365
    44 #endif
    4566
    46 }
     67} // namespace KJS
  • trunk/JavaScriptCore/kjs/grammar.y

    r12317 r13089  
    44 *  This file is part of the KDE libraries
    55 *  Copyright (C) 1999-2000 Harri Porten ([email protected])
     6 *  Copyright (C) 2006 Apple Computer, Inc.
    67 *
    78 *  This library is free software; you can redistribute it and/or
     
    3839/* default values for bison */
    3940#define YYDEBUG 0
    40 #if !__APPLE__ /* work around the fact that YYERROR_VERBOSE causes a compiler warning in bison code */
     41#if !PLATFORM(DARWIN)
     42    // avoid triggering warnings in older bison
    4143#define YYERROR_VERBOSE
    4244#endif
  • trunk/JavaScriptCore/kjs/identifier.cpp

    r12329 r13089  
    2626// runs at init time.
    2727
    28 #if !defined(WIN32) // can't get this to compile on Visual C++ yet
     28#if !PLATFORM(WIN_OS) // can't get this to compile on Visual C++ yet
    2929#define AVOID_STATIC_CONSTRUCTORS 1
    3030#endif
  • trunk/JavaScriptCore/kjs/internal.cpp

    r13015 r13089  
    5353namespace KJS {
    5454
    55 #if !__APPLE__
    56  
    57 #ifdef WORDS_BIGENDIAN
    58   const unsigned char NaN_Bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 };
    59   const unsigned char Inf_Bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 };
    60 #elif defined(arm)
    61   const unsigned char NaN_Bytes[] = { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 };
    62   const unsigned char Inf_Bytes[] = { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 };
    63 #else
    64   const unsigned char NaN_Bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f };
    65   const unsigned char Inf_Bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f };
    66 #endif
    67  
    68   const double NaN = *(const double*) NaN_Bytes;
    69   const double Inf = *(const double*) Inf_Bytes;
    70  
    71 #endif
    72 
    73 #if WIN32
     55#if PLATFORM(WIN_OS)
    7456#define copysign _copysign
    7557#endif
  • trunk/JavaScriptCore/kjs/interpreter.cpp

    r13015 r13089  
    3737#include "object.h"
    3838#include "operations.h"
    39 #if __APPLE__
     39#include "types.h"
     40#include "value.h"
     41
     42#if PLATFORM(MAC)
    4043#include "runtime.h"
    4144#endif
    42 #include "types.h"
    43 #include "value.h"
    4445
    4546namespace KJS {
     
    125126        CString message = comp.value()->toObject(exec)->toString(exec).UTF8String();
    126127        int line = comp.value()->toObject(exec)->get(exec, "line")->toUInt32(exec);
    127 #ifdef WIN32
     128#if PLATFORM(WIN_OS)
    128129        printf("%s line %d: %s\n", f.c_str(), line, message.c_str());
    129130#else
     
    326327}
    327328
    328 #if __APPLE__
     329// bindings are OS X WebKit-only for now
     330#if PLATFORM(MAC)
    329331void *Interpreter::createLanguageInstanceForValue(ExecState *exec, int language, JSObject *value, const Bindings::RootObject *origin, const Bindings::RootObject *current)
    330332{
    331333    return Bindings::Instance::createLanguageInstanceForValue (exec, (Bindings::Instance::BindingLanguage)language, value, origin, current);
    332334}
    333 
    334335#endif
    335336
  • trunk/JavaScriptCore/kjs/interpreter.h

    r13015 r13089  
    396396    virtual bool isSafeScript(const Interpreter*) { return true; }
    397397 
    398 #if __APPLE__
     398#if PLATFORM(MAC)
    399399    virtual void *createLanguageInstanceForValue(ExecState*, int language, JSObject* value, const Bindings::RootObject* origin, const Bindings::RootObject* current);
    400400#endif
  • trunk/JavaScriptCore/kjs/lookup.cpp

    r12317 r13089  
    2626
    2727#include "lookup.h"
    28 
    29 #ifdef HAVE_CONFIG_H
    30 #endif
    3128
    3229using namespace KJS;
  • trunk/JavaScriptCore/kjs/lookup.h

    r13015 r13089  
    300300
    301301// Work around a bug in GCC 4.1
    302 #if !__GNUC__
     302#if !COMPILER(GCC)
    303303#define KJS_GCC_ROOT_NS_HACK ::
    304304#else
  • trunk/JavaScriptCore/kjs/math_object.cpp

    r12921 r13089  
    3535#include "math_object.lut.h"
    3636
    37 #if WIN32
     37#if PLATFORM(WIN_OS)
    3838
    3939#include <float.h>
  • trunk/JavaScriptCore/kjs/object.cpp

    r13015 r13089  
    4141#include "nodes.h"
    4242
    43 #ifndef NDEBUG
    44 //#define JAVASCRIPT_CALL_TRACING 1
    45 #endif
     43#define JAVASCRIPT_CALL_TRACING 0
    4644
    4745#if JAVASCRIPT_CALL_TRACING
  • trunk/JavaScriptCore/kjs/object.h

    r12949 r13089  
    3030// maximum global call stack size. Protects against accidental or
    3131// malicious infinite recursions. Define to -1 if you want no limit.
    32 #if __APPLE__
     32#if PLATFORM(DARWIN)
    3333// Given OS X stack sizes we run out of stack at about 350 levels.
    3434// If we improve our stack usage, we can bump this number.
  • trunk/JavaScriptCore/kjs/operations.cpp

    r12848 r13089  
    3131#include <stdlib.h>
    3232
    33 #ifndef HAVE_FUNC_ISINF
    34 #ifdef HAVE_IEEEFP_H
     33#if HAVE(FUNC_ISINF) && HAVE(IEEEFP_H)
    3534#include <ieeefp.h>
    3635#endif
    37 #endif /* HAVE_FUNC_ISINF */
    38 
    39 #if HAVE_FLOAT_H
     36
     37#if HAVE(FLOAT_H)
    4038#include <float.h>
    4139#endif
     
    4543namespace KJS {
    4644
    47 #if !__APPLE__
     45#if !PLATFORM(DARWIN)
     46  // FIXME: should probably be inlined on other platforms too, and controlled exclusively
     47  // by HAVE macros
     48
    4849
    4950bool isNaN(double d)
    5051{
    51 #ifdef HAVE_FUNC_ISNAN
     52#if HAVE(FUNC_ISNAN)
    5253  return isnan(d);
    53 #elif defined HAVE_FLOAT_H
     54#elif HAVE(FLOAT_H)
    5455  return _isnan(d) != 0;
    5556#else
     
    6061bool isInf(double d)
    6162{
    62 #if WIN32
     63  // FIXME: should be HAVE(_FPCLASS)
     64#if PLATFORM(WIN_OS)
    6365  int fpClass = _fpclass(d);
    6466  return _FPCLASS_PINF == fpClass || _FPCLASS_NINF == fpClass;
    65 #elif defined(HAVE_FUNC_ISINF)
     67#elif HAVE(FUNC_ISINF)
    6668  return isinf(d);
    67 #elif HAVE_FUNC_FINITE
     69#elif HAVE(FUNC_FINITE)
    6870  return finite(d) == 0 && d == d;
    69 #elif HAVE_FUNC__FINITE
     71#elif HAVE(FUNC__FINITE)
    7072  return _finite(d) == 0 && d == d;
    7173#else
     
    7678bool isPosInf(double d)
    7779{
    78 #if WIN32
     80  // FIXME: should be HAVE(_FPCLASS)
     81#if PLATFORM(WIN_OS)
    7982  return _FPCLASS_PINF == _fpclass(d);
    80 #elif defined(HAVE_FUNC_ISINF)
     83#elif HAVE(FUNC_ISINF)
    8184  return (isinf(d) == 1);
    82 #elif HAVE_FUNC_FINITE
    83   return finite(d) == 0 && d == d; // ### can we distinguish between + and - ?
    84 #elif HAVE_FUNC__FINITE
    85   return _finite(d) == 0 && d == d; // ###
     85#elif HAVE(FUNC_FINITE)
     86  return !finite(d) && d == d; // ### can we distinguish between + and - ?
     87#elif HAVE(FUNC__FINITE)
     88  return !_finite(d) && d == d; // ###
    8689#else
    8790  return false;
     
    9194bool isNegInf(double d)
    9295{
    93 #if WIN32
     96  // FIXME: should be HAVE(_FPCLASS)
     97#if PLATFORM(WIN_OS)
    9498  return _FPCLASS_NINF == _fpclass(d);
    95 #elif defined(HAVE_FUNC_ISINF)
     99#elif HAVE(FUNC_ISINF)
    96100  return (isinf(d) == -1);
    97 #elif HAVE_FUNC_FINITE
     101#elif HAVE(FUNC_FINITE)
    98102  return finite(d) == 0 && d == d; // ###
    99 #elif HAVE_FUNC__FINITE
     103#elif HAVE(FUNC__FINITE)
    100104  return _finite(d) == 0 && d == d; // ###
    101105#else
  • trunk/JavaScriptCore/kjs/operations.h

    r12317 r13089  
    2929  class JSValue;
    3030
    31 #if __APPLE__
     31#if PLATFORM(DARWIN)
    3232  inline bool isNaN(double d) { return isnan(d); }
    3333  inline bool isInf(double d) { return isinf(d); }
     
    3535  inline bool isNegInf(double d) { return isinf(d) && d < 0; }
    3636#else
    37   /**
    38    * @return True if d is not a number (platform support required).
    39    */
    4037  bool isNaN(double d);
    41   /**
    42    * @return True if d is infinite (platform support required).
    43    */
    4438  bool isInf(double d);
    4539  bool isPosInf(double d);
  • trunk/JavaScriptCore/kjs/regexp.cpp

    r12317 r13089  
    3333  : _flags(flags), _numSubPatterns(0)
    3434{
    35 #ifdef HAVE_PCREPOSIX
     35#if HAVE(PCREPOSIX)
    3636
    3737  int options = PCRE_UTF8;
     
    6161#endif
    6262
    63 #else /* HAVE_PCREPOSIX */
     63#else /* HAVE(PCREPOSIX) */
    6464
    6565  int regflags = 0;
     
    8585RegExp::~RegExp()
    8686{
    87 #ifdef HAVE_PCREPOSIX
     87#if HAVE(PCREPOSIX)
    8888  pcre_free(_regex);
    8989#else
     
    107107    return UString::null();
    108108
    109 #ifdef HAVE_PCREPOSIX
     109#if HAVE(PCREPOSIX)
    110110
    111111  if (!_regex)
  • trunk/JavaScriptCore/kjs/regexp.h

    r12317 r13089  
    2727#include "config.h"
    2828
    29 #ifdef HAVE_PCREPOSIX
     29#if HAVE(PCREPOSIX)
    3030#include <pcre.h>
    3131#else  // POSIX regex - not so good...
     
    3333#include <regex.h>
    3434}
    35 #endif //HAVE_PCREPOSIX
     35#endif // HAVE(PCREPOSIX)
    3636
    3737#include "ustring.h"
     
    5252
    5353  private:
    54 #ifdef HAVE_PCREPOSIX
     54#if HAVE(PCREPOSIX)
    5555    pcre *_regex;
    5656#else
  • trunk/JavaScriptCore/kjs/testkjs.cpp

    r12924 r13089  
    3535#include <stdlib.h>
    3636#include <string.h>
    37 #if HAVE_SYS_TIME_H
     37#if HAVE(SYS_TIME_H)
    3838#include <sys/time.h>
    3939#endif
     
    5353   
    5454private:
    55 #if !WIN32
     55#if !PLATFORM(WIN_OS)
    5656    // Windows does not have timeval, disabling this class for now (bug 7399)
    5757    timeval m_startTime;
     
    6262void StopWatch::start()
    6363{
    64 #if !WIN32
     64#if !PLATFORM(WIN_OS)
    6565    gettimeofday(&m_startTime, 0);
    6666#endif
     
    6969void StopWatch::stop()
    7070{
    71 #if !WIN32
     71#if !PLATFORM(WIN_OS)
    7272    gettimeofday(&m_stopTime, 0);
    7373#endif
     
    7676long StopWatch::getElapsedMS()
    7777{
    78 #if !WIN32
     78#if !PLATFORM(WIN_OS)
    7979    timeval elapsedTime;
    8080    timersub(&m_stopTime, &m_startTime, &elapsedTime);
  • trunk/JavaScriptCore/kjs/ustring.cpp

    r12949 r13089  
    2929#include <stdio.h>
    3030#include <ctype.h>
    31 #ifdef HAVE_STRING_H
     31#if HAVE(STRING_H)
    3232#include <string.h>
    3333#endif
    34 #ifdef HAVE_STRINGS_H
     34#if HAVE(STRINGS_H)
    3535#include <strings.h>
    3636#endif
  • trunk/JavaScriptCore/kjs/ustring.h

    r12949 r13089  
    2828#include <kxmlcore/RefPtr.h>
    2929#include <kxmlcore/PassRefPtr.h>
    30 
    31 #if __APPLE__
    32 #include <sys/types.h>
    33 #ifndef KWQ_UNSIGNED_TYPES_DEFINED
    34 #define KWQ_UNSIGNED_TYPES_DEFINED
    35 typedef unsigned char uchar;
    36 typedef unsigned long ulong;
    37 #endif
    38 #endif
    3930
    4031#include <stdint.h>
Note: See TracChangeset for help on using the changeset viewer.